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

MATLAB code, anything helps! MATLAB code, anything helps! 2. Use the linspace co

ID: 645163 • Letter: M

Question

MATLAB code, anything helps!

MATLAB code, anything helps! 2. Use the linspace command or the colon operator : to create a vector t with 91 elements: 1, 1.1, 1.2,..., 10 and define the function y = e^t/10 sin(t)/t^2+1(make sure you use ; to suppress the output for both t and y). (a) Plot the function y in black and include a title with the expression for y. (b) Make the same plot as in part (a), but rather than displaying the graph as a curve, show the unconnected data points. To display the data points with small circles, use plot(t,y,o). Now combine the two plots with the command plot(t,y,o-) to show the line through the data points as well as the distinct data points. 3. Use the command plot3(x,y,z) to plot the circular helix x(t) = sint, y(t) cost, z(t) = t 0 leq t leq 20. NOTE: Use semicolon to suppress the output when you define the vectors t, x, y and z. Make sure you use enough points for your graph so that the resulting curve is nice and smooth. 4. Plot y=cosx in red with a solid line and z=1-x^2/2+x^4/24 in blue with a dashed line for 0 leq x leq Pi on the same Plot. Hint: Use plot(x,y,r,x,z, = = ). Add a grid to the plot using the command grid on. NOTE: Use semicolon to suppress the output when you define the vectors x, y and z. Make sure you use enough points for your graph so that the resulting curves are nice and smooth. MATLAB code: 1. All points with coordinates z = rcos(Theta) and y = rsin(Theta), where r is a constant, lie on a circle with radius r, i.e. satisfy the equation x^2 + y^2 = r^2. Create a row vector for Theta with the values 0,Pi/4,Pi/2,3Pi/4,Pi Take r = 2 and compute the row vectors x and y. Now check that x and y indeed satisfy the equation of a circle, by computing the radius r = root x^2 + y^2. Hint: To calculate r you will need the array operator . for squaring x and y. Of course, you could also compute x^2 by x.*x.

Explanation / Answer

for 2) t = 1:91;

y = to the given equation ;

a) plot(t,y)

b)hold on

plot(t,y)

plot(t,y,'bo-')

hold off

3) t = 0:20;

x = sint;

y = cost;

z=t

plot3(x,y,z)

here is some of the beggining hope this helps