Clear Filters
Clear Filters

yy3 is generating a straight line while it should generate a curve, i don't understand what is wrong!!!

6 views (last 30 days)
function ABC
% Initialization of paramters
Pr=6.2;
M=4;
Bi=0.3;
beta=0.2;
ks1=0.5;
ks2=0.1;
rhos1=0.2;
rhos2=0.3;
n=3;
kbf=0.598;
phi1=0.1;
phi2=0.04;
rhocps1=0.3;
rhocps2=0.1;
rhof=997.1;
kf=0.613;
rhocpf=4179;
A1=((1-phi1)^(2.5)).*((1-phi2)^(2.5));
B1=(1-phi2).*((1-phi1).*rhof + rhos1.*phi1) + rhos2.*phi2;
A2=B1*(1/rhof); % rho_Hnf/rho_f
B2=ks2+(n-1)*kbf-(n-1)*(kbf-ks2).*phi2;
B3=ks2+(n-1)*kbf+(kbf-ks2).*phi2;
C5=B2/B3; % k_Hnf/k_bf Nanofluid Constant
B4=ks1+(n-1)*kf-(n-1)*(kf-ks1).*phi1;
B5=ks1+(n-1)*kf+(kf-ks1).*phi1;
C6=B4/B5; % k_bf/k_f
A4=C5*C6; % k_Hnf/k_f
B6=(1-phi2)*((1-phi1)*rhocpf+phi1*rhocps1)+phi2*rhocps2; % rhocp_Hnf
B7=1/rhocpf;
A3=B6*B7; % rhocp_Hnf/rhocp_f
% Initial Condition Input
sol = bvpinit(linspace(0,8,100), [1 0 0 0 0 0 0 0]);
% solution in structure form
sol1 = bvp4c(@bvpexam2, @bcexam2, sol);
x1 = sol1.x;
y1 = sol1.y;
%%% Plotting of the temperature
plot(x1, y1(7, :))
hold on
function res=bcexam2(y0, yinf)
res=[y0(2)-1;y0(5)-beta;y0(1)+y0(4);y0(8)+(Bi/A4)*(1-y0(7)); yinf(2);yinf(5);yinf(7); yinf(4)];
end
function dydx = bvpexam2(~,y)
yy1=A1*(A2*(y(2)^2-(y(1)+y(4))*y(3))+M*y(2));
yy2 = A1*(A2*(y(5)^2-(y(1)+y(4))*y(6))+M*y(5));
yy3 =-(A3/A4)*Pr*(y(1)+y(4))*y(8);
dydx= [y(2);y(3);yy1;y(5);y(6);yy2;y(7);yy3];
end
end
  4 Comments

Sign in to comment.

Accepted Answer

Torsten
Torsten on 11 Aug 2023
Edited: Torsten on 11 Aug 2023
As initial condition for y(7), you set y(7) = 0, and you define the differential equation for y(7) as dy(7)/dx = y(7). The solution is y(7) = 0 for all x - and that's what is plotted.
The line
dydx= [y(2);y(3);yy1;y(5);y(6);yy2;y(7);yy3];
must read
dydx= [y(2);y(3);yy1;y(5);y(6);yy2;y(8);yy3];
  3 Comments
Fareeha
Fareeha on 11 Aug 2023
@Torsten i have another question
in function
function res=bcexam2(y0, yinf)
res=[y0(2)-1;y0(5)-beta;y0(1)+y0(4);y0(8)+(Bi/A4)*(1-y0(7)); yinf(2);yinf(5);yinf(7)];
end
I removed one BC, now i have 8 vectors in dydx and 7 BC, in such condition how could code work?
Torsten
Torsten on 11 Aug 2023
You need as many boundary conditions as there are first-order differential equations. Otherwise, you get a one-dimensional solution manifold.
Consider
y '' = c with y(0) = 1
The solution is
y(x) = 1 + a1*x + c/2*x^2
with arbitrary parameter a1.

Sign in to comment.

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!