# Looking for help on graphing

1 view (last 30 days)
Caleb Coombe on 25 Jun 2021
Edited: Nikhil Sapre on 25 Jun 2021
Hello,
I have this equation:
uSol(t) = (2*exp(-(5*t)/8)*(39*cos((39^(1/2)*t)/8) + 5*39^(1/2)*sin((39^(1/2)*t)/8)))/39
and I would like to graph it for t = 0 through 50. How can I do this?
Thank you!
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

Star Strider on 25 Jun 2021
One approach —
syms t
uSol(t) = (2*exp(-(5*t)/8)*(39*cos((39^(1/2)*t)/8) + 5*39^(1/2)*sin((39^(1/2)*t)/8)))/39
uSol(t) =
figure
fplot(uSol, [0 50])
grid
.
##### 2 CommentsShowHide 1 older comment
Star Strider on 25 Jun 2021
My pleasure!

Sign in to comment.

Nikhil Sapre on 25 Jun 2021
Edited: Nikhil Sapre on 25 Jun 2021
Hi Caleb,
Please find an example of the code below.
t = linspace(0,50,51);
uSol = zeros(1,length(t));
for i = 1:1:length(t)
uSol(i) = (2*exp(-(5*t(i))/8)*(39*cos((39^(1/2)*t(i))/8) + 5*39^(1/2)*sin((39^(1/2)*t(i))/8)))/39;
end
plot(t,uSol);
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Graph and Network Algorithms 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!