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

Can someone please explain how to solve for this using MatLab (6) Add all elemen

ID: 3890926 • Letter: C

Question

Can someone please explain how to solve for this using MatLab

(6) Add all elements of vector x = [3 7 2 9 4] (7) Multiply all elements of vector x [3 7 2 9 4] (8) Count the elements of vector x-3 7294] 9) Find the largest element in x [3 7 294 (10) Find the smallest element in x = [37 2 9 4] 4. Exercise: Anonymous and Inline Functions (1) Define an anonymous function for the following function. The anonymous function takes three inputs: x, a, and b. Make a plot of the function for x-0 to 5. Use a -2 and b -2. (x)--sin (2) Repeat the above task with an inline function.

Explanation / Answer

(6)

x = [3 7 2 9 4];

res=sum(x)

(7)

x = [3 7 2 9 4];

res=prod(x)

(8)

x = [3 7 2 9 4];

res=numel(x)

(9)

x = [3 7 2 9 4];

res=max(x)

(10)

x = [3 7 2 9 4];

res=min(x)

4>
(1)


x=[0:1:5]
y=myfunc(x,2,2)
plot(x,y)


function z=myfunc(x,a,b)
z=x/a;
z=z-(sin(x)^b)
end