Using MATLAB: I. Remove two rows and two columns from matrix E and save it in D
ID: 3812780 • Letter: U
Question
Using MATLAB:
I. Remove two rows and two columns from matrix E and save it in D
II. Find the vector "y" that has the square root of elements of "v" divided by elements of "w"
III. Find the vector "t" that is the result of multiplying vector "x" and Matrix "A"
IV. Find all of the positive elements in "y"
V. Change the first column in "A" to 1 1 ... 1 (25 ones)
V. Find the 10 by 25 matrix "H" that is a product of "D" and "A"
VI. Flip the arrays in matrix "D" in up/down direction.
VII. Find the 10 by 10 matrix "R" that is a product of vetor "x" and "x"
VIII. Find total number of negative elements in "R".
IX. Find all positive elements in "R" and store them in variable "c".
X. Create a 5 by 50 matrix "U" that has similar elements as matrix "A"
Where...
vector "v" = 7+16*rand(10,1);
vector "w" = linspace(-134,271,10);
vector "E" = rand(12);
vector "x" = [-1.4:0.3:1.5];
and vector "A" is represented by:
for i = 1:25
for j = 1:10
A(i,j) = j-1;
end
end
Explanation / Answer
%I. Remove two rows and two columns from matrix E and save it in D
E = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 0 1; 1 2 5 6;];
[x, y] = size(E); %Will find the size of matrix E.
D = E(3:x, 3:y); %Will pick the matrix removing 2 rows, and 2 columns.
%II. Find the vector "y" that has the square root of elements of "v"
% divided by elements of "w"
v = [2 4 5 9 16];
w = [2 3 4 3 2];
y = sqrt(v) ./ w; %Calculates the square root of vector v, divided by w.
%III. Find the vector "t" that is the result of multiplying vector "x" and Matrix "A"
A = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 0 1; 1 2 5 6;];
x = [5 6 7 8 9];
t = x * A; %Multiples x with A, provided it agrees with rows of x, and columns of A.
%IV. Find all of the positive elements in "y"
y = [1 2 3 -4; -1 2 -3 -4; 1 -2 3 -4; -1 2 0 1; 1 2 5 6;];
y(y > 0); %Will list only positive elements of y.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.