Need Assistance for 'bvp4c' function
Ältere Kommentare anzeigen
Guys, appreciate your time for this. Below is the coding which the error always persist. I need advise so much, thanks in advance.
xlow = 0;
xhigh = 10;
solinit = bvpinit(linspace(xlow,xhigh,2000), [0 0 0 1 0]);
options = bvpset('RelTol',1e-6,'AbsTol',1e-9);
sol = bvp4c(@bvp4ode,@bvp4bc,solinit,options);
xint = linspace(xlow,xhigh);
Sxint = deval(sol,xint);
function dydx = bvp4ode (x,y)
z=10;
n=1;
pr=0.733;
dydx = [y(2);y(3);(-(z+((n+3)/4)*y(1))*y(3)+((n+1)/2)*(y(2)^2)-y(4))/(1+z*x)
;y(5);(pr*n*y(2)*y(4)-(z+((n+3)/4)*y(1)*pr)*y(5))/(1+z*x)]
z=10;
n=1;
pr=0.733;
function res = bvp4bc (ya,yb)
res = [ya(1);ya(2);ya(4)-1;yb(2);yb(4)];
plot(xint,Sxint(2,:))
Error: Undefined function or variable 'bvp4ode'.
Error in bvparguments (line 105)
testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 130)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
I am new to MATLAB, appreciate all the help I can get.
Antworten (2)
Walter Roberson
am 13 Apr. 2016
0 Stimmen
Which file did you store bvp4ode in? Which file did you store bvp4bc in? Which file did you store your script in?
1 Kommentar
Justin Quek
am 13 Apr. 2016
Torsten
am 14 Apr. 2016
Try this:
function driver
xlow = 0;
xhigh = 10;
solinit = bvpinit(linspace(xlow,xhigh,2000), [0 0 0 1 0]);
options = bvpset('RelTol',1e-6,'AbsTol',1e-9);
sol = bvp4c(@bvp4ode,@bvp4bc,solinit,options);
xint = linspace(xlow,xhigh);
Sxint = deval(sol,xint);
plot(xint,Sxint(2,:))
function dydx = bvp4ode(x,y)
z=10;
n=1;
pr=0.733;
dydx = [y(2);y(3);(-(z+((n+3)/4)*y(1))*y(3)+((n+1)/2)*(y(2)^2)-y(4))/(1+z*x)
;y(5);(pr*n*y(2)*y(4)-(z+((n+3)/4)*y(1)*pr)*y(5))/(1+z*x)];
function res = bvp4bc(ya,yb)
res = [ya(1);ya(2);ya(4)-1;yb(2);yb(4)];
Best wishes
Torsten.
3 Kommentare
Justin Quek
am 14 Apr. 2016
Torsten
am 14 Apr. 2016
Walter Roberson
am 14 Apr. 2016
Store all of that in driver.m
Kategorien
Mehr zu Boundary Value Problems finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!