ode45 second order
์กฐํ ์: 2 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
please, I want to plot second order and use function ode45. So just now I can't write function.
y" = 3.6sin(t) - 60y - 5y'
and this is my question ๐๐
function dy=model(t,y)
dy = [y(2); 3.6*sin(t) - 60*y(0) - 5*y(1)]
end
and this ๐๐ is my error function
๋๊ธ ์: 0
๋ต๋ณ (1๊ฐ)
Alan Stevens
2021๋
4์ 18์ผ
Matlab indices start at 1, so you want
dy = [y(2); 3.6*sin(t) - 60*y(1) - 5*y(2)];
๋๊ธ ์: 3
Alan Stevens
2021๋
4์ 18์ผ
"how can i add sin input to this order"
I'm not sure what you mean. Your second order ode already has 3.6*sin(t) as a forcing function. Do you mean you want to add another term to the forcing function e.g.
y'' + 5*y' + 60*y = 3.6*sin(t) + 2*sin(2*t)
If so, then just make
dy = [y(2); 3.6*sin(t) + 2*sin(2*t) - 60*y(1) - 5*y(2)];
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Ordinary Differential Equations์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!