hold on option is not working in the present code
Mostra commenti meno recenti
M = 0.2; L = 0.01; K = 0.1; G = 2; Pr = 2; s = 0.1; Ec = 0.01; m = 0.5; R = 0.5; fw = 0.5; a = 1; n = 0.5;
for M = [0 .1 .2]
for fw = [-1 0 1]/2
ODE = @(x,y)[ y(2); y(3); (y(2)^2 - y(1)*y(3) + M*y(2) - K*y(5) - L*y(6))/(1+K); y(5); (y(2)*y(4) - y(1)*y(5) + K*(2*y(4) + y(3)))/G;
y(7); Pr*( m*y(2)*y(6) - s*y(6) - Ec*y(3)^2 - y(1)*y(7) )/(1+(4/3)*R) ];
BC = @(ya,yb)[ya(1)-fw; ya(2)-1-a*(1+K)*ya(3); ya(4)+n*ya(3); ya(7)-1; yb([2;4;6])]; xa = 0; xb = 6; x = linspace(xa,xb,101);
solinit = bvpinit(x,[0 1 0 1 0 1 0]); sol = bvp5c(ODE,BC,solinit); S = deval(sol,x); f0 = deval(sol,0);
set( 0,'DefaultAxesColorOrder',[1 0 0; 0 1 0; 0 0 0] )
figure(11),plot(x,S(2,:),'LineWidth',2); hold on,
ax = gca; ax.XColor = 'black'; ax.YColor = 'black'; ax.XAxis.FontSize = 10; ax.YAxis.FontSize = 10; ax.FontWeight = 'bold';
xlabel('\bf\eta','Color','blue'); ylabel('\bff^{\prime}(\eta)','Color','blue');
L(1) = plot(nan,nan,'r-','Linewidth',2); L(2) = plot(nan,nan,'g-','Linewidth',2); L(3) = plot(nan,nan,'k-','Linewidth',2);
legend(L,{'\color{red}\bffw = - 0.5','\color{green}\bffw = 0','\color{black}\bffw = 0.5'},'Box','off');
end
end
4 Commenti
Adam Danz
il 17 Set 2021
But still, the code is presented very poorly and many people would avoid digging in simply because of it's organization. To make the code as easy to read as possible, start off by using new lines for each statement.
Cris LaPierre
il 17 Set 2021
And I ran your code so that the error messages are displayed.
MINATI PATRA
il 17 Set 2021
MINATI PATRA
il 17 Set 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

