matlab help Generate the following matrix without typing in

matlab help

Generate the following matrix without typing in each individual element. Utilize the colon operator, linspace, and other built-in MATLAB functions. 5 6 9 15 7 12 9 24 9 24 9 33 11 48 9 42 Generate the following matrix without typing in each individual element. Utilize the colon operator, linspace, and other built-in MATLAB functions. 5 10 15 0 0 0 12 7 5

Solution

Que 17

Matlab code:

m = zeros(4,4);
m(:,1) = (linspace(5,11,4))\';
m(1:2,2) = (linspace(6,12,2))\';
m(3:4,2) = (linspace(24,48,2))\';
m(:,3) = (linspace(9,9,4))\';
m(:,4) = (linspace(15,42,4))\';
m

Output:

m =

    5    6    9   15                                                                                                                       

    7   12    9   24                                                                                                                       

    9   24    9   33                                                                                                                       

   11   48    9   42

Que 18

m = zeros(3,3);
m(1,:) = (linspace(5,15,3));
m(2,:) = (linspace(0,0,3));
m(3,1:2) = (linspace(12,7,2));
m(3,2:3) = (linspace(7,5,2));
m

Output:

m =

5   10   15

    0    0    0                                                                                                                            

   12    7    5

matlab help Generate the following matrix without typing in each individual element. Utilize the colon operator, linspace, and other built-in MATLAB functions.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site