Using Matlab Create the following matrix A A 6 43 2 11 87 1

Using Matlab.....

Create the following matrix A: A = [6 43 2 11 87 12 6 34 0 5 34 18 7 41 9] Use the matrix A to: Create a five-element row vector named va that contains the elements of the second row of A. Create a three-element row vector named vb that contains the elements of the fourth column of A. Create a ten-element row vector named vc that contains the elements of the first and second rows of A. Create a six-element row vector named vd that contains the elements of the second and fifth columns of A.

Solution

A = [6,43,2,11,87;12,6,34,0,5;34,18,7,41,9]
va = A(2,:)
vb = A(:,4)
vc = A(1:2,:)
vd = [A(:,2),A(:,5)]

% sample output

A =                                                                                                                                                                                                            

                                                                                                                                                                                                               

    6   43    2   11   87                                                                                                                                                                                      

   12    6   34    0    5                                                                                                                                                                                      

   34   18    7   41    9                                                                                                                                                                                      

                                                                                                                                                                                                               

va =                                                                                                                                                                                                           

                                                                                                                                                                                                               

   12    6   34    0    5                                                                                                                                                                                      

                                                                                                                                                                                                               

vb =                                                                                                                                                                                                           

                                                                                                                                                                                                               

   11                                                                                                                                                                                                          

    0                                                                                                                                                                                                          

   41                                                                                                                                                                                                          

                                                                                                                                                                                                               

vc =                                                                                                                                                                                                           

                                                                                                                                                                                                               

    6   43    2   11   87                                                                                                                                                                                      

   12    6   34    0    5                                                                                                                                                                                      

                                                                                                                                                                                                               

vd =                                                                                                                                                                                                           

                                                                                                                                                                                                               

   43   87                                                                                                                                                                                                     

    6    5                                                                                                                                                                                                     

   18    9                                                                                                                                                                                                     

Using Matlab..... Create the following matrix A: A = [6 43 2 11 87 12 6 34 0 5 34 18 7 41 9] Use the matrix A to: Create a five-element row vector named va that
Using Matlab..... Create the following matrix A: A = [6 43 2 11 87 12 6 34 0 5 34 18 7 41 9] Use the matrix A to: Create a five-element row vector named va that

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site