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

FOR MATLAB PLEASE HELP WITH CODE ((A)) Given the vector x = [1 3 8 11 0 6], crea

ID: 3814978 • Letter: F

Question

FOR MATLAB PLEASE HELP WITH CODE

((A)) Given the vector x = [1 3 8 11 0 6], create a short set of commands that will ((A)) Add up the values of the elements (Check with sum.)

((B)) Computes the running sum (for element j, the running sum is the sum of the elements from 1 to j, inclusive. Check with cumsum.)

((C)) Computes the sine of the given x-values (should be a vector Computes the running sum (for element j, the running sum is the sum of the elements from 1 to j, inclusive. Create an 10-by-10 array of random numbers (use rand). Move through the array, element by element, and set any value that is less than 0.2 to 0 and any value that is greater than (or equal to) 0.2 to 1

Explanation / Answer

(A)

x = [1 3 8 11 0 6];

sm = 0;

for i = 1:6

   sm = sm+x(i);

end

disp(sm);

disp(sum(x));