Looking for help on graphing
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
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
figure
fplot(uSol, [0 50])
grid
.
댓글 수: 2
Nikhil Sapre
2021년 6월 25일
편집: Nikhil Sapre
2021년 6월 25일
This is a better solution but the user will need to have Symbolic Math Toolbox to execute it.
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);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!