Access over 20 million homework & study documents

8 Generate the following matrix without typing in each individual e

Content type
User Generated
Rating
Showing Page:
1/3
8. Generate the following matrix without typing in each
individual element. Utilize the colon operator, linspace,
and other built-in MATLAB functions.
1 14 7 15
3 28 7 26
5 42 7 37
7 56 7 48
9. From the above matrix, use MATLAB commands to find
the elements (or series of elements) listed below:
a. 2 nd row, 3rd column
b. 1 st row, 4th column
c. All rows in 2nd column
d. All columns in 3rd row
e. All columns in 2 nd and 4th row
f. All rows in 1st and 4th columns
g. The 2nd through 4th rows in the 1st through 3rd
columns
h. The 2nd through 3rd rows in the 2nd through 3rd
columns
i. The 1st and 4th rows in the 2nd and 4th columns
Must Be typed in MATLab only! Please explain necessarfy
steps. will rate thank you!
Solution
Here is the code for you:
%8. Generate the following matrix without typing in each
individual element.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3
%Utilize the colon operator, linspace, and other built-in
MATLAB functions.
%1 14 7 15
%3 28 7 26
%5 42 7 37
%7 56 7 48
Array(:, 1) = [1 14 7 15];
for i = 2 : 1 : 4
for j = 2 : 1 : 4
if j == 1
Array(i, j) = Array(i-1, j) + 2;
else if j == 2
Array(i, j) = Array(i-1, j) + 14;
else if j == 3
Array(i, j) = Array(i-1, j);
else
Array(i, j) = Array(i-1, j) + 11;
end
end
end
end
end
disp (Array);
%a. 2 nd row, 3rd column
disp (Array(2, 3));

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
8. Generate the following matrix without typing in each individual element. Utilize the colon operator, linspace, and other built-in MATLAB functions. 1 14 7 15 3 28 7 26 5 42 7 37 7 56 7 48 9. From the above matrix, use MATLAB commands to find the elements (or series of elements) listed below: a. 2 nd row, 3rd column b. 1 st row, 4th column c. All rows in 2nd column d. All columns in 3rd row e. All columns in 2 nd and 4th row f. All rows in 1st and 4th columns g. The 2nd through 4th rows in the 1st through 3rd columns h. The 2nd through 3rd rows in the 2nd through 3rd columns i. The 1st and 4th rows in the 2nd and 4th columns Must Be typed in MATLab only! Please explain necessarfy steps. will rate thank you! Solution Here is the code for you: %8. Generate the following matrix without typing in each individual element. %Utilize the colon operator, linspace, and other built -in MATLAB ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Documents