Hello, I am trying to solve this second order ODE.
(d^2(x)/dt^2)+(dx/dt)+x=0
x(0)=0,x'(0)=1
t=[0 10]
I have tried using ODE 45 and dsolve , however when I always get some kind of error message either regarding my t input or my x''. If anyone has can lend assistance that would be much appreciated. Thanks in advance.

댓글 수: 1

Jan
Jan 2016년 4월 27일
편집: Jan 2016년 4월 27일
Please post your code and the a copy of the complete error message. Then suggesting an improvement is easier and you can learn what went wrong.

댓글을 달려면 로그인하십시오.

답변 (2개)

Torsten
Torsten 2016년 4월 27일

0 개 추천

You can't prescribe x''(0) for a 2nd order ODE.
Best wishes
Torsten.

댓글 수: 4

Derek Bindbeutel
Derek Bindbeutel 2016년 4월 27일
Oh sorry its actually x'(0)=1
Torsten
Torsten 2016년 4월 27일
편집: Torsten 2016년 4월 27일
syms y(t)
Dy = diff(y);
dsolve(diff(y, 2) + diff(y) + y == 0, y(0) == 0, Dy(0) == 1)
Best wishes
Torsten.
Derek Bindbeutel
Derek Bindbeutel 2016년 4월 27일
Thanks this is a lot of help. How will add a time span from 0 to 10 t=[0,10] affect this method?
Torsten
Torsten 2016년 4월 27일
No. t will be a variable in the answer.
Solution is here:
Best wishes
Torsten.

댓글을 달려면 로그인하십시오.

Jan
Jan 2016년 4월 27일
편집: Jan 2016년 4월 27일

0 개 추천

function yourIntegration
x0 = [0; 1];
[t, x] = ode45(@YourODE, x0, [0, 10]);
plot(t, x);
function dx = YourODE(t, x)
dx = [x(2) ; ...
-x(2) - x(1)];

질문:

2016년 4월 27일

편집:

Jan
2016년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by