How do I get the second solution?

7 visualizaciones (últimos 30 días)
Latifah
Latifah el 25 de Oct. de 2022
Comentada: Torsten el 2 de Abr. de 2023
function Shrink;
format short
global lambda Pr
Pr = 1; %fixed
a = 0;
b = 10; % b = infinity
lambda =-1.1; %mixed convection parameter (lambda)
solinit = bvpinit(linspace(a,b,100),@Shrink_init);
options = bvpset('stats','on','RelTol',1e-10);
sol = bvp4c(@Shrink_ode,@Shrink_bc,solinit,options);
figure(1)
plot(sol.x,sol.y(2,:),'k--','linewidth',1)
xlabel('\eta','fontsize',16)
ylabel('f\prime(\eta)','fontsize',16)
hold on
figure(2)
plot(sol.x,sol.y(4,:),'k--','linewidth',1)
xlabel('\eta','fontsize',16)
ylabel('\theta(\eta)','fontsize',16)
hold on
sol.y(3,1) % The value of f''(0)
-sol.y(5,1) % The value of -theta'(0)
descris = [sol.x; sol.y];
save ('start_main.mat', '-struct', 'sol');
function dydx = Shrink_ode(x,y,Pr,lambda);
global Pr lambda
dydx = [y(2)
y(3)
y(2)^2-y(1)*y(3)-1-lambda*y(4)
y(5)
-Pr*y(1)*y(5)+Pr*y(2)*y(4)];
function res = Shrink_bc(ya,yb);
res = [ya(1)
ya(2)
yb(2)-1
ya(4)-1
yb(4)];
function v = Shrink_init(x);
v =[];???????????????
  1 comentario
Jan
Jan el 25 de Oct. de 2022
The question is not clear. Please take the time to explain any details.

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 25 de Oct. de 2022
Pr = 1; %fixed
lambda =-1.1; %mixed convection parameter (lambda)
a = 0;
b = 10; % b = infinity
solinit = bvpinit(linspace(a,b,100),@Shrink_init);
options = bvpset('stats','on','RelTol',1e-10);
sol = bvp4c(@(x,y)Shrink_ode(x,y,Pr,lambda),@Shrink_bc,solinit,options);
Warning: Unable to meet the tolerance without using more than 2000 mesh points.
The last mesh of 887 points and the solution are available in the output argument.
The maximum residual is 2.0419e-06, while requested accuracy is 1e-10.
The solution was obtained on a mesh of 2631 points. The maximum residual is 2.042e-06. There were 55777 calls to the ODE function. There were 226 calls to the BC function.
figure(1)
plot(sol.x,sol.y(2,:),'k--','linewidth',1)
xlabel('\eta','fontsize',16)
ylabel('f\prime(\eta)','fontsize',16)
figure(2)
plot(sol.x,sol.y(4,:),'k--','linewidth',1)
xlabel('\eta','fontsize',16)
ylabel('\theta(\eta)','fontsize',16)
%hold on
sol.y(3,1) % The value of f''(0)
ans = -0.2153
-sol.y(5,1) % The value of -theta'(0)
ans = -0.1098
%descris = [sol.x; sol.y];
%save ('start_main.mat', '-struct', 'sol');
function dydx = Shrink_ode(x,y,Pr,lambda);
dydx = [y(2)
y(3)
y(2)^2-y(1)*y(3)-1-lambda*y(4)
y(5)
-Pr*y(1)*y(5)+Pr*y(2)*y(4)];
end
function res = Shrink_bc(ya,yb);
res = [ya(1)
ya(2)
yb(2)-1
ya(4)-1
yb(4)];
end
function v = Shrink_init(x);
v =[0 1 0 1 1];
end
  2 comentarios
MOSLI KARIM
MOSLI KARIM el 1 de Abr. de 2023
Hi Mr. Torsten, I have a question, why did you choose the initial conditions
function v = Shrink_init(x);
v =[0 1 0 1 1];
end
Torsten
Torsten el 2 de Abr. de 2023
I took one of the boundary conditions as initial value for the complete region of integration.
Somewhat arbitrary - but often it works.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by