How to solve a non linear 3rd order differential equation

조회 수: 1 (최근 30일)
Sumedh Soman
Sumedh Soman 2020년 7월 4일
댓글: darova 2020년 7월 5일
Hi, I need to solve a 3rd order, non linear differential equation. I would preferably like a symbolic solution for the equation, as this equation is the input for another script. The equation is as follows:
where m is a constant (for my purposes, m =1)
f is a function of variable eta, and the initial conditions are as follows:
;
;
and
I tried using the code mentioned below, but it is unable to give me a symbolic solution. Can anybody please help me solve this problem?
m = 1;
syms f(eta)
Df = diff(f,eta);
D2f = diff(f,eta,2);
ode = diff(f,eta,3)+0.5*(m+1)*f*D2f+m*(1-Df^2) == 0;
cond1 = f(0) == 0;
cond2 = Df(0) == 0;
cond3 = D2f(10^100) == 1;
conds = [cond1 cond2 cond3];
uSol(eta) = dsolve(ode,conds)
  댓글 수: 6
Sumedh Soman
Sumedh Soman 2020년 7월 4일
this is the solver code I used:
xmesh = linspace(0,100,5);
solinit = bvpinit(xmesh, @guess);
sol = bvp4c(@bvpfcn, @bcfcn, solinit);
plot(sol.x, sol.y, '-o');
function dydx = bvpfcn(x,y) % equation to solve
dydx = zeros(3,1);
dydx = [y(2) y(3) (-((1+1)/2)*(y(3)*y(1))-1*(1-(y(2))^2))];
end
function res = bcfcn(ya,yb)
res = [ya(1) ya(2) yb(3)];
end
function g = guess(x)
g = [x 1 0];
end
I saw that y = x was a solution of this equation, which is why I have used it as guess(x)
darova
darova 2020년 7월 5일
here are some corrections

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by