当前位置:网站首页>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
边栏推荐
- Introduction notes to machine learning
- JVM I: introduction to JVM and understanding of class files
- Multithreading and high concurrency III: AQS underlying source code analysis and implementation classes
- After launching the MES system, these changes have taken place in the enterprise
- 《性能之巅第2版》阅读笔记(二)--性能观察工具
- Multi project design and development · introduction to class library project
- Iso8191 test is mentioned in as 3744.1. Are the two tests the same?
- Live online source code, JS dynamic effect, sidebar scrolling fixed effect
- 02 mongodb data types, important concepts and common shell instructions
- 2022-06-27:给出一个长度为n的01串,现在请你找到两个区间, 使得这两个区间中,1的个数相等,0的个数也相等, 这两个区间可以相交,但是不可以完全重叠,即两个区间的左右端点不可以完全一样。
猜你喜欢
27 years, Microsoft IE is over!
02 mongodb data types, important concepts and common shell instructions
Iso8191 test is mentioned in as 3744.1. Are the two tests the same?
成长一夏 挑战赛来袭 | 学习、创作两大赛道,开启导师报名啦!
From zero to one, I will teach you to build a "search by text and map" search service (I)
基于正点原子stm32的mini板的TFTLCD显示实验
2022年6月对自己近况的一次总结
抖音實戰~關注博主
How to traverse collections Ordereddict, taking it and forgetting items
In the era of video explosion, who is supporting the high-speed operation of video ecological network?
随机推荐
Tiktok actual battle ~ take off the blogger
From meeting a big guy to becoming a big guy, shengteng AI developer creation day brings infinite possibilities to developers
A queue of two stacks
互联网的发展促进了无界零售、数字零售、即时零售等一系列新模式的出现
Pinda general permission system (day 5~day 6)
Establishment of SSH Framework (Part 2)
The coming wave of Web3
What is the level 3 password complexity of ISO? How often is it replaced?
关于 SY8120I 的DC-DC的降压芯片的学习(12V降至3.3V)
Go language -select statement
有关函数模板的那些小知识-.-
Building log analysis system with elk (III) -- Security Authentication
Problems with cat and dog queues
Multithreading and high concurrency III: AQS underlying source code analysis and implementation classes
Web3来临时的风口浪尖
Database garbled
leetcode - 329. Longest increasing path in matrix
2022年中国音频市场年度综合分析
利用ELK 搭建日志分析系统(二)—— 部署安装
一文详解|增长那些事儿