Problem last element is 37, increment of create a row vector in which the first
ID: 1842166 • Letter: P
Question
Problem last element is 37, increment of create a row vector in which the first element is 2 and the with an 5 between the elements: (2 7 12 37. Problem 2 is 81 and the last Create a vector with 9 equally spaced elements in which the first element element is 12. Problem 3 decrease with increments of create a column vector in which the first element is 22.5, the elements 2.5, and the last element is 0. (Hint: a column vector can be created by transposing a row vector.) Problem 4 vector with 15 equally spaced elements in which the first element is -21 and the last element is 12. Problem 5 Create the following matrix by typing one command. Do not type individual elements explicitly. D 0 0 0 0 0 000 66 0 0 0 66 Problem 6 Create two row vectors: a -4 10 0.5 1.8 -2.3 7 b- 0.7 9-5 3-0.6 12 (a) Use the two vectors in a MATLAB command to create a 2 x 4 matrix such that the first row consists of 2 through 5 of vector a, and the elements second row consists of elements 3 through 6 of vector b. such that the first column consists of elements 2 through 4 of vector a, the second column consists of elements 4 through 6 of vector a, the third col- umn consists of elements 1 through 3 of vector b, and the fourth column consists of elements 3 through 5 of vector b. Problem 7 Create the following matrix A: 7 8 9 10 11 12 3 14 15 16 17 18 Use the matrix A to: (a) Create a six-element row vector named ha that contains the elements of the first row of (by create a three-element row vector named hb that contains the elements of the sixth column of A. (c) Create a six-element row vector named hc that contains the first three elements of the second row ofA and the last three element of the third rowExplanation / Answer
A=zeros(1,8); % Defining the Matrix 1x8 with all elements as zero
A(1,1) = 2; % Choosing the first element to be 2
for j=2:8 % a loop to find the rest of the elements
A(1,j) = A(1,j-1) + 5 % adding 5 to the next row element
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.