In this exercise, you will be given two matrices A and B. You will write a set o
ID: 3197223 • Letter: I
Question
In this exercise, you will be given two matrices A and B. You will write a set of commands in MATLAB that determine whether Row A and Row B are subspaces of the same space R". If yes, your code has to determine if dim RowA-dim RowB and, finally, if RowA RowB (Obviously, when two subspaces have the same dimension, it might not be true that they are the same set. For example, a line through the origin in R3 is a one-dimensional subspace of R3, but two lines might be different sets.) Use MATLAB function rank within your code. Recall, the rank of a matrix can be defined as the dimension of the row space of the matrix *In MATLAB, create function [ ] = rowspace(A,B) 1) You should begin with calculating the numbers of columns of matrices A and B (output them) and the dimensions of the Row spaces of A and B. A possible code for this part with the output messages is format compact format rat m-size (A, 2) n-size (B, 2) k-rank (A) p-rank (B) fprintf( 'din of Row A is k = %iin', k) fprintf( 'din of Row B is p- tiin',p)Explanation / Answer
function [ ] = subspace [A,B]
m=size [A.1]
n=size [B,1]
if m=n
disp['COl A and COl B are subspace of different spaces']
return
elsefprintf/[Col A and Col Bare subspaces of R percentage ; m]
k=rank[A]; percentage can be done by size [A,2] also
l=rank[B];
if k=1
disp['The dimensions of Col A and Col B ARE different']
else
if is equal[A,B]
disp['Col A = Col B']
else
disp['The dimentions of Col A and Col B are thr same , but Col A = Col B'];
end
end
percentage test wuth various types of matrices
A = rand [10,5]
B = rand [10,5]
subspace [A,B]
A = rand [10,5]
B = rand [10,5]
subspace[A,B]
A = zeros[10,5]
B= zeros[10,5]
subspaces[A,B]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.