H20? 4:54 PM l uwm.courses.wisconsin.edu C CS240 Lab Exercise 09 Due: In Lab, th
ID: 3737366 • Letter: H
Question
H20? 4:54 PM l uwm.courses.wisconsin.edu C CS240 Lab Exercise 09 Due: In Lab, the week of March 25th Main topics: Plotting 1. Open MATLAB Create a Function file named Lab09 a) Right click Current Folder title of that window o Select New File by moving mouse to that option (c) Click on Script in the pop-up menu a Type Lab09 in the highlight field and hit the enter key Double click the Lab09.m entry (that you just created) in the Current Folder window Modify the Script file so that it: a) Generates values for x and y from the equation where x ranges from -3 to 3 in increments of 0.5 ) Plots the resulting points (xy in a single grid window, whose x axis is defined to be [-2, 2] and whose y axis is defined to be,3. Use a diamond for your Mark/point. (c) Set the title of the plot to . Second Order Equation." label the y axis "y values, and the x axis ‘x values, and create a legend. s Once you get to this point, you should show your answers to your TA, and get checked off for this lab.Explanation / Answer
** Since you have not defined any function for y in terms of x, using sin function as y = sin(x). Replace this with original function.
Lab09.m
%a
x = -3:0.5:3
y = sin(x)
%b
plot(x,y,'-d') % -d is used for diamond
xlim([-2 2])
ylim([-1 3])
%c
title('Second order equation')
xlabel('x values')
ylabel('y values')
legend('y = sin(x)')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.