How do I get the second solution?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Torsten
2022-10-25
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);
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)
-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);
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 个评论
MOSLI KARIM
2023-4-1
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
2023-4-2
I took one of the boundary conditions as initial value for the complete region of integration.
Somewhat arbitrary - but often it works.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

