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

๋‹ต๋ณ€ (1๊ฐœ)

Alan Stevens
Alan Stevens 2021๋…„ 4์›” 18์ผ

0 ๊ฐœ ์ถ”์ฒœ

Matlab indices start at 1, so you want
dy = [y(2); 3.6*sin(t) - 60*y(1) - 5*y(2)];

๋Œ“๊ธ€ ์ˆ˜: 3

pattara tangjareansuk
pattara tangjareansuk 2021๋…„ 4์›” 18์ผ
how can i add sin input to this order
Alan Stevens
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)];
pattara tangjareansuk
pattara tangjareansuk 2021๋…„ 4์›” 18์ผ
i want to create system identification . my professor he said "you should create analytical solution and compare between lsim

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Ordinary Differential Equations์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์งˆ๋ฌธ:

2021๋…„ 4์›” 18์ผ

๋Œ“๊ธ€:

2021๋…„ 4์›” 18์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by