hi,
my code is:
function initial_fun
global rho g B P
rho=1; g=1; B=1; P=1;
xlow=0; xhigh=3;
solinit=bvpinit(linspace(xlow,xhigh,10),[1 0 0 0 2 2]);
sol=bvp4c(@bvp4ode,@bvp4bc,solinit);
xint=linspace(xlow,xhigh);
Sxint=deval(sol,xint);
plot(xint,Sxint(1,:))
%------------------------------------------------------
function dydx=bvp4ode(x,y)
global rho g B P
dydx = [ y(2); y(3); y(4); ((rho*g/B)*y(1)+P/B); y(1)^2];
%------------------------------------------------------
function res = bvp4bc(ya,yb)
res = [ya(2) ya(4) ya(6) yb(2) yb(3) yb(1)-0.05];
trying to solve for the five derivatives dy/dx to d5y/dx5.
However, it expects column vector of length 6 for bvp4ode. It was my understanding that for ode function, you state the derivatives, 1st derivative to 5th, whilst you give boundary conditions ranging from y(1) to y(6) and same for initial guess.
any help will be appreciated
thank you very much
my code is:
function initial_fun
global rho g B P
rho=1; g=1; B=1; P=1;
xlow=0; xhigh=3;
solinit=bvpinit(linspace(xlow,xhigh,10),[1 0 0 0 2 2]);
sol=bvp4c(@bvp4ode,@bvp4bc,solinit);
xint=linspace(xlow,xhigh);
Sxint=deval(sol,xint);
plot(xint,Sxint(1,:))
%------------------------------------------------------
function dydx=bvp4ode(x,y)
global rho g B P
dydx = [ y(2); y(3); y(4); ((rho*g/B)*y(1)+P/B); y(1)^2];
%------------------------------------------------------
function res = bvp4bc(ya,yb)
res = [ya(2) ya(4) ya(6) yb(2) yb(3) yb(1)-0.05];
trying to solve for the five derivatives dy/dx to d5y/dx5.
However, it expects column vector of length 6 for bvp4ode. It was my understanding that for ode function, you state the derivatives, 1st derivative to 5th, whilst you give boundary conditions ranging from y(1) to y(6) and same for initial guess.
any help will be appreciated
thank you very much