I don't understand what you try to do and what you are asking for.
Help me to set this code?
1 次查看(过去 30 天)
显示 更早的评论
hi I want to get one specific error value for some specific parameter change. I'm unable to extract specific value of error.
nk
function nk
a=0.1;
mu=0.0;
r=2.0;
Ec=0.3;
Nr=10;
solinit= bvpinit(linspace(a,100,1000),[0 0 0 0 0]);
% Set the options with the desired RelTol value
relTol = 1e-4;
AbsTol=1e-6;
options1 = bvpset('RelTol', relTol,'AbsTol',AbsTol);
sol = bvp5c(@Needleode,@Needlebc,solinit,options1);
eta = sol.x; % mesh points
f = sol.y; % solution values at the mesh points
plot(eta,f(1,:))
% Calculate the maximum error
exact_solution=1e-4;
E=max(abs(f - exact_solution));
%disp(E)
% Calculate the number of mesh points
num_meshpoints = length(eta);
%disp(num_meshpoints)
end
function dfdeta = Needleode(eta,f)
Pr=6.8;
Ec=0.3;
mu=0.0;
k=0.0;
Nr=10;
r=3.0;
t1=1+mu*f(4);
t2=1+k*f(4);
u=f(4)*(r-1)+1;
v=eta*(t2+(4/(3*Nr))*(u)^3);
ff1=-(1/(2*eta))*((1/t1)*-2*eta*mu*f(3)*f(5)+t1*f(1)*f(3)+2*f(3));
k_1=f(5)*t2+k*eta*(f(5)^2);
k_2=(1/2)*Pr*f(1)*f(5)+(1/t1)*4*Pr*Ec*f(3)^2;
k_3=(2/(3*Nr))*f(5)*(u^3);
k_4=(4/Nr)*(u^2)*eta*(f(5)^2)*(r-1);
ff2=-(1/(v)*(k_1+k_2+k_3+k_4));
dfdeta=[f(2);f(3);ff1;f(5);ff2];
end
function res = Needlebc(f0,finf)
a=0.1;e=1e-2;
res = [f0(1)-(a*e/2)
f0(2)-e/2
finf(2)-(1-e)/2
f0(4)-1
finf(4)-0
];
end
This is the code .
second i give the the exact solution value myself. How to calculate it manually?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!