How can I Solve a Second Order ODE with ODE45?

4 次查看(过去 30 天)
So I I have to solve the following ODE for y(t) using the ODE45 tool in MATLAB:
The ODE that I have to solve is:
13y''+0.27y'-0.35/y +3.5=1.2753
y(0)=0 y'(0)=0 for 0<=t<=5
  2 个评论
Jan
Jan 2016-5-4
What have you tried so far and which problems do you have?
Jack Glendenning
Jack Glendenning 2016-5-6
It's ok I managed to solve it: (note the question i have been given was actually in terms of x(t). I thought y(t) might be easier for people to see. That's why i asked with y(t).
%%Solving Second order ODE via ode45
%Will solve 0.13x''+0.27x'-0.35/x+3.5=1.2753
%x(2)=x(1)'
%eq1: x(1)'=x(2)
%eq2: x(2)'=(1.2753-3.5+0.35/x(1)-0.27*x(2))/0.13
ODEFUN = @(t,x) [x(2);(1.2753-3.5+0.35/x(1)-0.27*x(2))/0.13];
TSPAN = [0 5];
X0=[0.03;0];
[TOUT, XOUT]= ode45(ODEFUN, TSPAN, X0); figure
plot(TOUT,XOUT)

请先登录,再进行评论。

回答(1 个)

Torsten
Torsten 2016-5-4
There is a singularity in t=0 ...
Best wishes
Torsten.

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by