Generating a plot using shm function
2 views (last 30 days)
Show older comments
Hi, I am trying to plot the SHM function online. I kind of plotted the first part of the curve but need further help with it.
x=0:0.1:10;
x1=10:0.1:0;
y=smf(x,[0,9]);
plot(x,y);
ylim([0 1.05]);
I want a curve which starts from (10, 1) and drops to (0,0.6) in the figure that I have attached. Can anyone help me with how to draw that curve? Thanks :)
0 Comments
Accepted Answer
Image Analyst
on 3 Apr 2015
Call "hold on" and then get a new y with different parameters. Then call plot() again with the new y.
1 Comment
Image Analyst
on 4 Apr 2015
How about:
x=0:0.1:10;
y=smf(x,[0,9]);
plot(x,y); % Forward direction.
ylim([0 1.05]);
hold on;
x1=10:0.1:0;
y=smf(x1,[0,9]);
plot(x1,y); % Reverse direction.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!