How do I get the second solution?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (1)
Torsten
am 25 Okt. 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);
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 Kommentare
MOSLI KARIM
am 1 Apr. 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
am 2 Apr. 2023
I took one of the boundary conditions as initial value for the complete region of integration.
Somewhat arbitrary - but often it works.
Siehe auch
Kategorien
Mehr zu Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

