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

Test your understanding of MATLAB with these short questions Each question shoul

ID: 2079407 • Letter: T

Question

Test your understanding of MATLAB with these short questions Each question should not require more than a single line of command or explanation. Provide the commands and the results obtained for each of the following operations: Given C [57 30 29 25 14 0 -21 0 8 9 11 18 0 50], provide the MATLAB commands to execute the following operations Return the size of C Delete the zeros (0) from the vector C (you could use the find function) Set the negative values of C to zero. Extract the values of C greater than 3 in a vector D e. Add 3 to the values of C that are even (use mod (C, 2) Compute the average (mean), the standard deviation (std) and the variance (var) of the values of C Compute the product prod of the non-zero elements of C obtain the maximum (max) and minimum (min) value of C

Explanation / Answer

a.) Inorder to get the size of the matrix C use the command [m,n] = size(C). This will give you no of rows and columns in the place of m and n.

b.) Inorder to delete the zeros.

k=length(C);

for i=0:(k-1)

if C[i] = 0

C[i] = =[];

end

end

c.) Inorder to set negative values to zero.

D=~C;

k=length(C);

for i=1:(k-1)

if D[i] >0

D[i] = = 0;

end

end

d.) D=zeros();

k=length(C);

for i=1:(k-1)

if C[i]>3

C[i] == D[i];

end

end

e.) k=length(C)

for i=1:(k-1)

if (C[i]%2==0)

C[i] = C[i]+3;

end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote