Using MATLAB: a. Do all the following in a script named handlesPractice.m b. Fir
ID: 2248665 • Letter: U
Question
Using MATLAB:
a. Do all the following in a script named handlesPractice.m
b. First, make a variable x that goes from 0 to 2 , and then make y=sin(x).
c. Make a new figure and do plot(x,y,’r’)
d. Set the x limit to go from 0 to 2 (xlim)
e. Set the xtick property of the axis to be just the values [0 pi 2*pi], and set xticklabel to be {‘0’,’1’,’2’}. Use set and gca
f. Set the ytick property of the axis to be just the values -1:.5:1. Use set and gca
g. Turn on the grid by doing grid on.
h. Set the ycolor property of the axis to green, the xcolor property to cyan, and the color property to black (use set and gca)
i. Set the color property of the figure to a dark gray (I used [.3 .3 .3]). Use set and gcf
j. Add a title that says ‘One sine wave from 0 to 2’ with fontsize 14, fontweight bold, and color white. Hint: to get the to display properly, use pi in your string. Matlab uses a Tex or Latex interpreter in xlabel, ylabel, and title. You can do all this just by using title, no need for handles.
k. Add the appropriate x and y labels (make sure the shows up that way in the x label) using a fontsize of 12 and color cyan for x and green for y. Use xlabel and ylabel
Explanation / Answer
b)
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
c)
plot(x,y,’r’) % it will excicute 3d graph
d) for limits
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.