Plotting sine wave for a ODE Problem

Hello all, I need some help on trying to plot these as a sine wave curve in Matlab, but can't seem to figure out how. Here's what I have:
t=0:5
r1=[(9.81/16)-(2.40/4)]*exp(-2*t)+(9.81/8)*sin(2*t);
r2=[(9.81/16)-(2.45/4)]*exp(-2*t)+(9.81/8)*sin(2*t);
r3=[(9.81/16)-(2.50/4)]*exp(-2*t)+(9.81/8)*sin(2*t);
figure(1) plot(t,r1) grid on
figure(2) plot(t,r2) grid on
figure(3) plot(t,r3) grid on
They are in the right plot and looks. But can't seem to get them into the sine wave curve I need them in. Any help would be great. Thanks.

 Accepted Answer

Use the linspace function to define ‘t’:
t = linspace(0,5);

2 Comments

That was easy. Thanks.
As always, my pleasure.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!