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

1- Write a Matlab assignment statement to fill a row matrix with the positive ev

ID: 2990520 • Letter: 1

Question

1- Write a Matlab assignment statement to fill a row matrix with the positive even integers less that or equal to 5,000

2- Write a Matlab assignment statement to fill a column matrix with the positive even integers less that or equal to 5,000

3- use this function : y= 3x2 + 2x +1

3a-what is the Matlab statement to form a Matlab anonymous function that represents this function? (quadratic)

3b- what Matlab statements would you use to plot this function over the interval [?2,2] (use linespace)

3c- what Matlab statement(s) could you use to integrate thisfunction over the interval [?2,2] (quadrature)

3e- What Matlab statement(s) could you use to estimate the integral of this function over the interval[?2,2] using Monte Carlo?

Explanation / Answer

1) x = 2:2:5000;

2) x = transpose(2:2:5000);

3) Simply store coefficients from higher order to least order in a variable

3a)p = [3,2,1]

3b) p = [3,2,1];

t = linspace(-2,2);

y = polyval(p,t);

plot(t,y);

3c)   f = @(x) ((3.*x^2)+(2.*x)+1)
Q = integral(f,-2,2)