# Can it be possible to draw Fig. 4 with Pr (0 to 2) on X-axis and for different values of M=0,1,2 OR plot(Nt,-T0(5)) with M=0,1,2

1 view (last 30 days)
MINATI on 25 Dec 2018
Commented: MINATI on 11 Feb 2019
function main
Pr=6.2; fw=0.5; Nb=.5;L=-1; K=.100;Nt=.5;Le=1;R=1; Kc=0.2;
%M=1;
M=input('M=');
xa=0;xb=6;
solinit=bvpinit(linspace(xa,xb,100),[0 1 0 1 0 1 0]);
sol=bvp4c(@ode,@bc,solinit);
xint=linspace(xa,xb,100);
sxint=deval(sol,xint);
function res=bc(ya,yb)
res=[ya(1)-fw; ya(2)-L; ya(4)-1; Nb*ya(7)+Nt*ya(5);yb(2); yb(4); yb(6)];
end
function dydx=ode(x,y)
dydx=[y(2); y(3); y(2)^2+(M+K)*y(2)-y(3)*y(1);
y(5); -(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R);
y(7); (Nt/Nb)*(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R)-Le*y(7)*y(1)+Kc*Le*y(6)];
end
% T0 = deval(sol,0)
% plot(Nt,-T0(5))
plot(xint,sxint([4],:),'--','Linewidth',1); %for f'
title('Fig.4 Variation of Temperature Profile f(\eta)with M ')
xlabel('\eta');
ylabel('f(\eta)');
hold on
end

#### 1 Comment

MINATI on 11 Feb 2019
Can it be posiible to find analytical solution(symbolic notation) of the given code. Pl. help

madhan ravi on 25 Dec 2018
Edited: madhan ravi on 25 Dec 2018
function main
L=-1;
fw=0.5;
Nb=.5;
Nt=.5;
Pr=6.2;
K=.100;
Le=1;
R=1;
Kc=0.2;
for M=0:2
xa=0;xb=6;
solinit=bvpinit(linspace(xa,xb,100),[0 1 0 1 0 1 0]);
sol=bvp4c(@(x,y)ode(x,y,M,Pr,Nb,K,Nt,Le,R,Kc),@(ya,yb)bc(ya,yb,L,fw,Nb,Nt),solinit);
xint=linspace(xa,xb,100);
sxint=deval(sol,xint);
figure
plot(xint,sxint(4,:),'--','Linewidth',1); %for f'
title(['Fig.4 Variation of Temperature Profile f(\eta)with M = ' ,num2str(M)])
xlabel('\eta');
ylabel('f(\eta)');
end
end
function res=bc(ya,yb,L,fw,Nb,Nt)
% ^^^^^^^^^^^^^---- parameterization
res=[ya(1)-fw; ya(2)-L; ya(4)-1; Nb*ya(7)+Nt*ya(5);yb(2); yb(4); yb(6)];
end
function dydx=ode(x,y,M,Pr,Nb,K,Nt,Le,R,Kc)
% ^^^^^^^^^^^^^^^^^^^^---- parameterization
dydx=[y(2); y(3); y(2)^2+(M+K)*y(2)-y(3)*y(1);
y(5); -(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R);
y(7); (Nt/Nb)*(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R)-Le*y(7)*y(1)+Kc*Le*y(6)];
end

Show 1 older comment
madhan ravi on 25 Dec 2018
Anytime :) , do the same way I showed you for M , remove figure and add hold on as it's in your question.
it's not likely to keep adding question one by one in each comment ... (please read how to parameterize a function)
function main
L=-1;
fw=0.5;
Nb=.5;
Nt=.5;
K=.100;
Le=1;
R=1;
Kc=0.2;
M=0:2;
Pr=0:2;
for i=1:numel(Pr) % if number of Pr and M vary use nested loops
xa=0;xb=6;
solinit=bvpinit(linspace(xa,xb,100),[0 1 0 1 0 1 0]);
sol=bvp4c(@(x,y)ode(x,y,M(i),Pr(i),Nb,K,Nt,Le,R,Kc),@(ya,yb)bc(ya,yb,L,fw,Nb,Nt),solinit);
xint=linspace(xa,xb,100);
sxint=deval(sol,xint);
plot(xint,sxint(4,:),'--','Linewidth',1); %for f'
hold on
title(['Fig.4 Variation of Temperature Profile f(\eta)with M = ' ,num2str(M),' Pr = ',num2str(Pr)])
xlabel('\eta');
ylabel('f(\eta)');
end
end
function res=bc(ya,yb,L,fw,Nb,Nt)
% ^^^^^^^^^^^^^---- parameterization
res=[ya(1)-fw; ya(2)-L; ya(4)-1; Nb*ya(7)+Nt*ya(5);yb(2); yb(4); yb(6)];
end
function dydx=ode(x,y,M,Pr,Nb,K,Nt,Le,R,Kc)
% ^^^^^^^^^^^^^^^^^^^^---- parameterization
dydx=[y(2); y(3); y(2)^2+(M+K)*y(2)-y(3)*y(1);
y(5); -(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R);
y(7); (Nt/Nb)*(Pr*y(1)*y(5)+Nb*y(5)*y(7)+Nt*y(5)^2)/(1+R)-Le*y(7)*y(1)+Kc*Le*y(6)];
end
MINATI on 25 Dec 2018
Actually M and Pr variation happens simultaneously with given data.
Thank you again
************
it's not likely to keep adding question one by one in each comment ... (please read how to parameterize a function
It is not as that you thought but still unsolved
MINATI on 2 Jan 2019
Dear
In X-axis variation should come as Pr=0 to 2 and parallaly variation for M=0, 1, 2 to draw fig. 4
I am still unable to draw