How do I get the second solution?
7 ビュー (過去 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!

