I want to solve a 3rd order differential equation,and plot it,what will be the code?

X''' +(1+cos(t))X'+sin(t)X=0
X(0)=0, X'(0)=1,X''(0)=0

1 Comment

How can i solve this eqaution?
F''' (eta)+ F(eta)F"(eta) + F'^2(eta) = 0
with the boundary conditions
F(0)=F''(0)=0 and F'(infinity)=0 and eta is 0:0.1:6
i want to plot it and create a table for it (eta-f-f'-f'')
I am new to using the ode solver in matlab and am not sure how to make it solve a equation. Any suggestion would be appreciated.
thank you
my email : ff223325@gmail.com

Sign in to comment.

Answers (1)

Use MATLAB's ODE45.
Best wishes
Torsten.

4 Comments

I tried 2nd order of ode45. What about 3rd order?
function dy = myfun(t,y)
dy=zeros(3,1);
dy(1)=y(2);
dy(2)=y(3);
dy(3)=-(1-cos(t))*y(2)-sin(t)*y(1);
Best wishes
Torsten.
Hello Mr.Torsen,
What is wrong in this coding? I got some error. Please help me in this. I have attached the problem and code below. Thanks in advance.
My equation and bcs are:
f'''+f f'' -1.3333 (f')^2 - f' = 0
f(0)=0 , f'(0)=1 , f'(infinity)=0
function heattransfernew
options=bvpset('stats','off','RelTol',1e-6);
solinit=bvpinit(linspace(0,6,20),[0,6]);
sol=bvp4c(@f, @OdeBC, solinit, options);
plot(sol.x,sol.y(1,:));
end
function dydx = f(x,y)
dydx(1) = y(2);
dydx(2) = y(3);
dydx(3) = -y(1).*y(3)+1.3333.*(y(2).^2)+y(2);
end
function res = OdeBC(ya,yb)
res = [ya(1)
ya(2)-1
yb(2)
];
end
Replace [0,6] by initial guess [1 1 1]
then your problem is solved

Sign in to comment.

Asked:

on 27 Nov 2015

Commented:

on 9 Jun 2023

Community Treasure Hunt

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

Start Hunting!