need help bvp4c
显示 更早的评论
hello my name is Tarik, i need to solve a problem (BVP using bvp4c).
f'''+f*f"+1-f'²+ λt*θ+λc*ϕ=0. 1/Pr*θ''+f*θ'-f'*θ=0. 1/Sc*ϕ"+f*ϕ'- f'*ϕ = 0
with the following boundary condition :
η=0, f(0)=0 ,f^' (0)=0, θ(0)=1,ϕ(0)=0 pour η→∞, f^' (η)→1, θ(η)→0,ϕ(∞)=1
so i wrote this code, but it's doesn't converge and doesn't satisfy the boundary condition please help me ******************************************* function example1_m
clear ,close,clc,
Pr=0.7;Sc=0.1;Rt=1;N=0.5;
options = []; % place holder
solinit = bvpinit(linspace(0,1,100),ones(7,1));
sol = bvp4c(@ex8ode,@ex8bc,solinit,options,Rt,N,Pr,Sc);
%fprintf('For N = %5i');
figure
lines = {'k-.','r--','b-'};
plot(sol.x,-sol.y(5,:),lines{1});
% axis([-0.1 1.1 0 1.7]);
title('graph df=fc(Rt)');
xlabel('x'); ylabel('f'' (x)');
drawnow
hold on
for i=1:1:4
N=0; %intialisé Rt sinon Rt seras écrasé ;
N = N+i;
sol = bvp4c(@ex8ode,@ex8bc,sol,options,Pr,Rt,N,Sc);
fprintf('For N = %5i',N);
lines = {'k-.','r--','b-','y.'};
plot(sol.x,-sol.y(5,:),lines{i});
drawnow
end
legend('N=1','N=2','N =3','N=4','N=5',1)
hold off
% --------------------------------------------------------------------------
function dydx = ex8ode(x,y,Rt,N,Pr,Sc)
%EX8ODE ODE function
dydx = [y(2)
y(3)
y(2)^2 - y(1)*y(3) - 1-Rt*(y(4)-N*y(6))
y(5)
-Pr*(y(1)*y(5))+Pr*(y(2)*y(4))
y(7)
-Sc*(y(1)*y(7))+Pr*(y(2)*y(6))];
% --------------------------------------------------------------------------
function res = ex8bc(ya,yb,Rt,N,Pr,Sc) %EX8BC Boundary conditions f
res = [ ya(1)
ya(2)
yb(2)-1
ya(4)-1
ya(6)
yb(4)
yb(6)-1];
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Boundary Value Problems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!