Need Assistance for 'bvp4c' function
古いコメントを表示
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.
回答 (2 件)
Walter Roberson
2016 年 4 月 13 日
0 投票
Which file did you store bvp4ode in? Which file did you store bvp4bc in? Which file did you store your script in?
Torsten
2016 年 4 月 14 日
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 件のコメント
Justin Quek
2016 年 4 月 14 日
Torsten
2016 年 4 月 14 日
Walter Roberson
2016 年 4 月 14 日
Store all of that in driver.m
カテゴリ
ヘルプ センター および File Exchange で Boundary Value Problems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!