How to draw Fig. 4
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function main
Pr=1; L=-1;D=1;
R=0.1;Sc=1;
% D=input('D='); %%D=0.5, 1, 1.5
xa=0;xb=6;
solinit=bvpinit(linspace(xa,xb,101),[0 1 0 1 0 1 0]);
sol=bvp4c(@ode,@bc,solinit);
xint=linspace(xa,xb,101);
sxint=deval(sol,xint);
figure(1)
plot(xint,sxint(2,:));
xlabel('\eta');
ylabel('f^\prime');
hold on
function res=bc(ya,yb)
res=[ya(1); ya(2)-L-D*ya(3); ya(4)-1; ya(7)-1; yb(2)-1; yb(4);yb(6)];
end
function dydx=ode(x,y)
dydx=[y(2); y(3); y(2)^2-y(3)*y(1)-1; y(5); -3*Pr*y(1)*y(5)/(3+4*R); y(7); -Sc*y(1)*y(7)];
end
end
Actually I dont know the concept of DUAL solution.
0 commentaires
Réponse acceptée
Stephan
le 30 Avr 2019
Modifié(e) : Stephan
le 30 Avr 2019
Hi,
maybe this is useful:
As shown in the link, the results strongly depend on the initial guesses - here is an example:
[sol1, sol2] = main
function [sol1, sol2] = main
Pr=1;
L=-1;
D=[0.5, 1, 1.5];
R=0.1;
Sc=1;
for k = 1:numel(D)
xa=0;xb=6;
solinit1=bvpinit(linspace(xa,xb,101),[0 1 0 1 0 1 0]);
solinit2=bvpinit(linspace(xa,xb,101),[-1 -1 -1 -1 -1 -1 0]);
sol1=bvp4c(@ode,@bc,solinit1);
sol2=bvp4c(@ode,@bc,solinit2);
figure(1)
plot(sol1.x,sol1.yp(1,:),'-r')
xlabel('\eta');
ylabel('f^\prime');
hold on
plot(sol2.x,sol2.yp(1,:),'-b')
end
hold off
function res=bc(ya,yb)
res=[ya(1); ya(2)-L-D(k)*ya(3); ya(4)-1; ya(7)-1; yb(2)-1; yb(4);yb(6)];
end
function dydx=ode(x,y)
dydx=[y(2); y(3); y(2)^2-y(3)*y(1)-1; y(5); -3*Pr*y(1)*y(5)/(3+4*R); y(7); -Sc*y(1)*y(7)];
end
end
results in:
Best regards
Stephan
5 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sparse Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!