当前位置:网站首页>Matlab exercises -- routine operation of matrix
Matlab exercises -- routine operation of matrix
2022-06-28 04:27:00 【Fanyi】
matlab Series articles : Catalog

List of articles
- One 、 subject
- Two 、 answer
- Topic 1
- Topic two
- Question three
- 1. Calculation ∣ A ∣ |A| ∣A∣, ∣ B ∣ |B| ∣B∣
- 2. Calculation A − 1 A^{-1} A−1、 B − 1 B^{-1} B−1
- 3. Calculation A A A、 B B B Eigenvalues and eigenvectors of
- 4. seek A A A、 B B B The transpose matrix of
- 5. The matrix A A A Upside down 、 matrix B B B Turn left and right
- 6. Calculation of matrix A A A The maximum and average values of each row of 、 The minimum value of each column
- 7. The output matrix B B B The row and column positions of the largest and smallest elements
- 8. Merge matrix A A A and B B B
- Question 4
One 、 subject
Let's set the matrix
A = ( 4 − 2 2 − 3 0 5 1 5 3 ) , B = ( 1 3 4 − 2 0 3 2 − 1 1 ) A= \begin{pmatrix} 4&-2&2\\ -3&0&5\\ 1&5&3 \end{pmatrix}, B= \begin{pmatrix} 1&3&4\\ -2&0&3\\ 2&-1&1 \end{pmatrix} A=⎝⎛4−31−205253⎠⎞,B=⎝⎛1−2230−1431⎠⎞
- (1) Extract matrix A A A First 、 Three elements , matrix B B B First 、 The three column ; Commutative matrix A A A First 、 Two lines , matrix B B B First 、 Two columns ;
- (2) Delete matrix A A A The second line of , Delete matrix B B B The second column of ;
- (3) Calculation ∣ A ∣ |A| ∣A∣, ∣ B ∣ |B| ∣B∣, A − 1 A^{-1} A−1, B − 1 B^{-1} B−1, A A A、 B B B Eigenvalues and eigenvectors of , A A A、 B B B The transpose matrix of , The matrix A A A Upside down 、 matrix B B B Turn left and right , Calculation of matrix A A A The maximum and average values of each row of 、 The minimum value of each column , The output matrix B B B The row and column positions of the largest and smallest elements 、 Merge matrix A A A and B B B;
- (4) Calculation A + B A+B A+B, A − B A-B A−B, A B AB AB, B A BA BA, A 2 A^2 A2, A ∗ B A^* B A∗B, A / B A/B A/B.
Two 、 answer
① Create two matrices :
>> A = [4 -2 2;-3 0 5;1 5 3] % Create a matrix A
A =
4 -2 2
-3 0 5
1 5 3
>> B = [1 3 4;-2 0 3;2 -1 1] % Create a matrix B
B =
1 3 4
-2 0 3
2 -1 1
Topic 1
1. Extract matrix A One 、 Three elements
>> A([1 3],:)
ans =
4 -2 2
1 5 3
2. Extract matrix B One 、 The three column
>> B(:,[1 3])
ans =
1 4
-2 3
2 1
3. Commutative matrix A First 、 Two lines
>> A([1 2],:) = A([2 1],:)
A =
-3 0 5
4 -2 2
1 5 3
4. Commutative matrix B First 、 Two columns
>> B(:,[1 2]) = B(:,[2 1])
B =
3 1 4
0 -2 3
-1 2 1
Topic two
1. Delete matrix A The second line of
>> A([2],:) = []
A =
-3 0 5
1 5 3
2. Delete matrix B The second column of
>> B(:,[2]) = []
B =
3 4
0 3
-1 1
Question three
1. Calculation ∣ A ∣ |A| ∣A∣, ∣ B ∣ |B| ∣B∣
>> det(A)
ans =
-158
>> det(B)
ans =
35
2. Calculation A − 1 A^{-1} A−1、 B − 1 B^{-1} B−1
>> inv(A)
ans =
0.1582 -0.1013 0.0633
-0.0886 -0.0633 0.1646
0.0949 0.1392 0.0380
>> inv(B)
ans =
0.0857 -0.2000 0.2571
0.2286 -0.2000 -0.3143
0.0571 0.2000 0.1714
3. Calculation A A A、 B B B Eigenvalues and eigenvectors of
>> [x1,y1] = eig(A)
x1 =
0.3055 0.8054 0.2410
0.7795 0.0974 0.5208
-0.5469 0.5847 0.8189
y1 =
-4.6842 0 0
0 5.2102 0
0 0 6.4740
>> [x2,y2] = eig(B)
x2 =
Column 1 to 2
0.8210 + 0.0000i -0.0719 + 0.5666i
0.0181 + 0.0000i -0.7330 + 0.0000i
0.5706 + 0.0000i 0.1776 - 0.3240i
Column 3
-0.0719 - 0.5666i
-0.7330 + 0.0000i
0.1776 + 0.3240i
y2 =
Column 1 to 2
3.8461 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i -0.9230 + 2.8720i
0.0000 + 0.0000i 0.0000 + 0.0000i
Column 3
0.0000 + 0.0000i
0.0000 + 0.0000i
-0.9230 - 2.8720i
4. seek A A A、 B B B The transpose matrix of
>> A.'
ans =
4 -3 1
-2 0 5
2 5 3
>> B.'
ans =
1 -2 2
3 0 -1
4 3 1
5. The matrix A A A Upside down 、 matrix B B B Turn left and right
>> flipud(A)
ans =
1 5 3
-3 0 5
4 -2 2
>> fliplr(B)
ans =
4 3 1
3 0 -2
1 -1 2
6. Calculation of matrix A A A The maximum and average values of each row of 、 The minimum value of each column
① Calculation A A A The maximum value per line of
>> max(A,[],2)
ans =
4
5
5
② Calculation A A A Mean value per line of
>> mean(A,2)
ans =
1.3333
0.6667
3.0000
③ Calculation A A A The minimum value of each column of
>> min(A,[],1)
ans =
-3 -2 2
7. The output matrix B B B The row and column positions of the largest and smallest elements
① The output matrix B B B The row and column position of the largest element
>> [x,y] = find(B==max(max(B)))
x =
1
y =
3
>> for i = 1:length(x)
fprintf('[%d,%d]\n',x(i),y(i))
end
[1,3]
① The output matrix B B B The row and column position of the smallest element
>> [x,y] = find(B==min(min(B)))
x =
2
y =
1
>> for i = 1:length(x)
fprintf('[%d,%d]\n',x(i),y(i))
end
[2,1]
8. Merge matrix A A A and B B B
>> [A,B]
ans =
4 -2 2 1 3 4
-3 0 5 -2 0 3
1 5 3 2 -1 1
Question 4
1. Calculation A + B A+B A+B
>> A+B
ans =
5 1 6
-5 0 8
3 4 4
2. Calculation A − B A-B A−B
>> A-B
ans =
3 -5 -2
-1 0 2
-1 6 2
3. Calculation A B AB AB
>> A*B
ans =
12 10 12
7 -14 -7
-3 0 22
4. Calculation B A BA BA
>> B*A
ans =
-1 18 29
-5 19 5
12 1 2
5. Calculation A 2 A^2 A2
>> A*A
ans =
24 2 4
-7 31 9
-8 13 36
6. Calculation A ∗ B A^* B A∗B
>> inv(A)*det(A)*B
ans =
-77.0000 -65.0000 -62.0000
-58.0000 68.0000 60.0000
17.0000 -39.0000 -132.0000
7. Calculation A / B A/B A/B
>> A/B
ans =
0 0 2.0000
0.0286 1.6000 0.0857
1.4000 -0.6000 -0.8000

边栏推荐
- Go language -select statement
- How to traverse collections Ordereddict, taking it and forgetting items
- 2021年终总结及2022年展望
- From meeting a big guy to becoming a big guy, shengteng AI developer creation day brings infinite possibilities to developers
- RT-Thread 双向链表(学习笔记)
- Database garbled
- Go language learning tutorial (14)
- AspNetCoreRateLimit 速率限制 接口访问限制 限流控制
- 【MySQL】多表连接查询
- Is the securities account opened by qiniu safe? How to open an account
猜你喜欢

成长一夏 挑战赛来袭 | 学习、创作两大赛道,开启导师报名啦!

How to write a software test report? Here comes the third party performance report template

MSc 307 (88) (2010 FTPC code) Part 2 smoke and toxicity test

10:00面试,10:02就出来了 ,问的实在是太...

@Several scenarios of transactional failure

Introduction notes to machine learning

2022年6月对自己近况的一次总结

Web3来临时的风口浪尖

From zero to one, I will teach you to build a "search by text and map" search service (I)

Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)
随机推荐
Little knowledge about function templates --
Elk builds log analysis system + Zipkin service link tracking integration
MSc 307 (88) (2010 FTPC code) Part 5 low flame spread test
Database garbled
How to write a software test report? Here comes the third party performance report template
Lazy loading and preloading of pictures
有关函数模板的那些小知识-.-
等保2.0密码要求是什么?法律依据有哪些?
Introduction to SQLSERVER database
Secouer le son et se battre ~ prêter attention au blogueur
Multithreading and high concurrency IV: varhandle, strong weak virtual reference and ThreadLocal
成长一夏 挑战赛来袭 | 学习、创作两大赛道,开启导师报名啦!
政策利好,20多省市开启元宇宙发展规划
[small program practice series] e-commerce platform source code and function implementation
Go language learning tutorial (14)
Multi project design and development · introduction to class library project
利用ELK 搭建日志分析系统(二)—— 部署安装
Is it true that qiniu business school gives away securities accounts? Is it safe to open an account
由两个栈组成的队列
Aspnetcoreratelimit rate limit interface access limit current limit control