Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB Please complete number 2 & 3 Programming with MATLAB-Quiz 2 1. Create the

ID: 3597851 • Letter: M

Question

MATLAB
Please complete number 2 & 3

Programming with MATLAB-Quiz 2 1. Create the following vectors and variables in Matlab, (80 pts) u= [-1,9,3,-35,10,-18] 2.5 w=1-0.7 10 14 11, Ill. u : A random row vector with 5 elements in the interval 1-17, 71 . P5×40 =11 1 1 V. g: A vector of 13 elements that are evenly spaced between |-105,95 VI, k= [15, 5,-5,-15,-25, ,-451] VII, E 12-9-1 10 11 -14 0.01 [1x104 1.1x104 1.2x10" 4.3x10. 0.04 33.0 0.07 32.0.. 1.0 1.0 ... VIll. Q=134.0 2. Find the answer to the folowing questions (80 pts) Eliminate the last element in v and find the vector y that is the elements of w divided by elements of v ll. Solve R = u× P and L-Prxw Il. Find all elements in vector k that are negative numbers and are greater than-100. IV, Change the element "-9" in E to "49" V. How many elements in Q are between 0.0002 and 0.602 Solve Z = Ex :/O (show the first column)

Explanation / Answer

1)))v=[-1,9,3,3.5,10,-18;];
v(6)=[]
w=[6
2.5
-0.7
10
14]
y=(w/v)
2))))))

u=[-17,-10,1,3,7]
p=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
r=u*p  
l=p'*w

output:


3)))))))

k=[15,5,-5,-15,-25,-35,-45]
idx=(k<0)&(k>-100)
for i = 1:7;
if (idx(i)==1)
k= k(idx)
end
end

output:

k=[-5,-15,-25,-35,-45]

4))))))))))

e=[-1 4 -6;
5 2 5;
12 -9 -1;
10 11 -14];
e(3,2)=9;
e

output:

e=[-1 4 -6;
5 2 5;
12 9 -1;
10 11 -14];
6))))))

e=[-1 4 -6;5 2 5; 12 -9 -1; 10 11 -14]
f=sortrows(e)
r=reshape(f,2,6)

output: