Third order differential equation with one final condition and two initial conditions

Hello, I am attempting to solve a third order differential equation with two initial condition f(0)=0 and f'(0)=1, and one final condition f'(infinity) using BVP5C. Is BVP5C the best approach? Also I am having trouble expressing my conditions since BVP5C documentation says the conditions must be of the form "bc(ya,yb)=0." I am not too experienced in matlab, and I will appreciate any help. Thank you albert

2 Comments

Please post, what you have tried so far. It is much easier to rectify some code instead of creating it (with some exceptions, especially if ASSIGNIN(EVAL(Str))...).
Scratch that.
I have successfully used BVP4C to solve a second order differential equation. However, I would like to know if it is possible to use bvp4c to solve a third order differential equation. This is the code that solves the second order diff equation:
function newdiffeqbvpc4(solver)
if nargin < 1
solver = 'bvp4c';
end
kappa=100;
v=-1;
bvpsolver = fcnchk(solver);
xinit = [linspace(0,kappa,5)];
yinit = [1; 0];
%initial profile
sol = bvpinit(xinit,yinit);
for m = 1
sol = bvpsolver(@f,@bc,sol);
end
figure
p=linspace(0,kappa);
q=deval(sol,p);
plot(p,q);
function dy = f(x,y)
%diff eq new project
dy(1)=y(2);
dy(2)=y(2)+m*y(1)^2;
dy=dy(:);
end
function res = bc(YL,YR)
% Boundary conditions
res = [ YL(1) + v
YR(1) ];
end
end

Sign in to comment.

Answers (0)

Asked:

on 1 Dec 2011

Community Treasure Hunt

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

Start Hunting!