MATLAB Answers

Looking for help on graphing

1 ビュー (過去 30 日間)
Caleb Coombe
Caleb Coombe 2021 年 6 月 25 日
編集済み: Nikhil Sapre 2021 年 6 月 25 日
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!

回答 (2 件)

Star Strider
Star Strider 2021 年 6 月 25 日
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 件のコメント
Star Strider
Star Strider 2021 年 6 月 25 日
My pleasure!

サインインしてコメントする。


Nikhil Sapre
Nikhil Sapre 2021 年 6 月 25 日
編集済み: Nikhil Sapre 2021 年 6 月 25 日
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);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by