help to find error in this?
2 次查看(过去 30 天)
显示 更早的评论
function Needle
a=0.01;
Pr=3.0;R=2.0;Nr=10;Ec=0.3;
solinit= bvpinit(linspace(a,40,100),[0 0 0 0 0]);
sol = bvp4c(@Needleode,@Needlebc,solinit);
eta = sol.x;
f = sol.y;
disp(f(2,1))
Cf=8*a^(1/2)*f(3);
disp(Cf)
function dfdeta = Needleode(eta,f)
f1_thetha=f(4)*(R-1)+1;
f2_thetha=eta*(1+4*(f1_thetha)^3/3*Nr);
dfdeta = [ f(2)
f(3)
-(1/(2*eta))*(f(1)*f(3)+2*f(3))
f(5)
-(f(5)+Pr*f(1)*f(5)/2+4*Ec*Pr*eta*(f(3))^2+2*f(5)*(f1_thetha)^3/3*Nr+4*eta*f(5)^2*(R-1)*(f1_thetha)^2/Nr)/f2_thetha
];
function res = Needlebc(f0,finf)
a=0.01;e=0.7;
res = [f0(1)-(a*e/2)
f0(2)-e/2
finf(2)-(1-e)/2
f0(1)-1
finf(1)-0
];
Error which i found is:
Undefined function or variable 'R'.
Error in Needle>Needleode (line 14)
f1_thetha=f(4)*(R-1)+1;
Error in bvparguments (line 105)
testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 130)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
Error in Needle (line 5)
sol = bvp4c(@Needleode,@Needlebc,solinit);
>>
0 个评论
采纳的回答
Sulaymon Eshkabilov
2023-2-4
Here is the corrected code. But you need to check your Jacobian matrix formulations; otherwise, this exercise is not solvable:
global R Nr Pr Ec
a=0.01;
Pr=3.0;R=2.0;Nr=10;Ec=0.3;
solinit= bvpinit(linspace(a,40,100),[0 0 0 0 0]);
sol = bvp4c(@Needleode,@Needlebc,solinit);
eta = sol.x;
f = sol.y;
disp(f(2,1))
Cf=8*a^(1/2)*f(3);
disp(Cf)
function dfdeta = Needleode(eta,f)
global R Nr Pr Ec
f1_thetha=f(4)*(R-1)+1;
f2_thetha=eta*(1+4*(f1_thetha)^3/3*Nr);
dfdeta = [ f(2);
f(3);
-(1/(2*eta))*(f(1)*f(3)+2*f(3));
f(5);
-(f(5)+Pr*f(1)*f(5)/2+4*Ec*Pr*eta*(f(3))^2+2*f(5)*(f1_thetha)^3/3*Nr+4*eta*f(5)^2*(R-1)*(f1_thetha)^2/Nr)/f2_thetha ];
end
function res = Needlebc(f0,finf)
a=0.01;e=0.7;
res = [f0(1)-(a*e/2);
f0(2)-e/2;
finf(2)-(1-e)/2;
f0(1)-1;
finf(1)-0];
end
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 DSP Algorithm Acceleration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!