Clear Filters
Clear Filters

How can I Solve a Second Order ODE with ODE45?

4 views (last 30 days)
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 Comments
Jan
Jan on 4 May 2016
What have you tried so far and which problems do you have?
Jack Glendenning
Jack Glendenning on 6 May 2016
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)

Sign in to comment.

Answers (1)

Torsten
Torsten on 4 May 2016
There is a singularity in t=0 ...
Best wishes
Torsten.

Tags

Community Treasure Hunt

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

Start Hunting!