Azzera filtri
Azzera filtri

Can I obtain results with more significant figures after the decimal place while using 'deval' in a bvp4c solver?

2 visualizzazioni (ultimi 30 giorni)
When I use deval in the bvp4c solver, I get only up to four digits after the decimal place.
Can't I get up to more than four decimal place like five to six decimal place?
What modifications would be needed then?
function sol= proj
clc;clf;clear;
global lambda gama Pr Rd Lew Nb Nt Mn m
%Nb=0.5;
gama=1;
Mn=1;
Rd=0.1;
Pr=10;
Nb=0.3;
Lew=10;
%lambda=1.5;
pp=0.5;
qq=0.3;
%figure(1)
%plot(2,1);hold on
options=bvpset('stats','on','RelTol',1e-9);
m=linspace(0,10);
solinit= bvpinit(m,[1,0,0,0,0,0,0]);
for i=1:numel(pp)
lambda=pp(i);
for i=1:numel(qq);
Nt=qq(i)
sol= bvp4c(@projfun,@projbc,solinit,options);
y1=deval(sol,0)
%f0 = deval(sol,0); f0(5,:)
%y2=deval(y(6,:),0)
solinit= sol;
plot(sol.x,sol.y(4,:),'LineWidth',2);hold on
%legend('N_{b} = 0.1','N_{b} = 0.3','N_{b} = 0.5');
end
end
end
function f= projfun(x,y)
global lambda gama Pr Rd Lew Nb Nt Mn
f= [y(2)
y(3)*(y(3)^2+gama^2)/(y(3)^2+lambda*gama^2)
y(2)^2/3-(2*y(1)*y(3)*(y(3)^2+gama^2))/(3*(y(3)^2+lambda*gama^2))+Mn*y(2)
y(5)
-(2*Pr*y(1)*y(5))/(3*(1+Rd)) - (Nb*y(5)*y(7))/(1+Rd) - (Nt*y(5)^2)/(1+Rd)
y(7)
-((2*Lew*y(1)*y(7))/3)+ (Nt/Nb)*((2*Pr*y(1)*y(5))/(3*(1+Rd)) + (Nb*y(5)*y(7))/(1+Rd) + (Nt*y(5)^2)/(1+Rd))];
end
function res= projbc(ya,yb)
res= [ya(1); ya(2)-1; ya(4)-1.0; ya(6)-1.0; yb(2); yb(4); yb(6)];
end

Risposta accettata

Stephan
Stephan il 29 Apr 2018
Modificato: Stephan il 29 Apr 2018
Hi,
typing:
format long
Lets you see more digits. This operation only affects the display and not the calculation.
See also here:
4 digits is the standard option format called short.
Best regards
Stephan

Più risposte (0)

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by