I could'not understand why my plot doesnot show line?

This is the code:
%function Needle
a=0.2;
r=2.0;
Pr=3.0;
Nr=10;
Ec=0.3;
solinit= bvpinit(linspace(a,15,100),[0 0 0 0 0]);
sol = bvp4c(@Needleode,@Needlebc,solinit);
eta = sol.x;
f = sol.y;
disp(f(3,1))
Cf=8*a^(1/2)*f(3);
disp(Cf)
nusselt=-2*(a^(1/2))*f(5)*(1+(4/3*Nr)*(r)^3);
disp(nusselt)
plot(eta,f(2),'r')
function dfdeta = Needleode(eta,f)
r=2.0;
Pr=3.0;
Nr=10;
Ec=0.3;
u=f(4)*(r-1)+1;
v=eta*(1+(4/3*Nr)*(u)^2);
ff1= -(1/(2*eta))*(f(1)*f(3)+2*f(3));
t1=f(5)+(1/2)*(Pr*f(1)*f(4));
t2=4*eta*Ec*Pr*f(3)^(2);
t3=(4/3*Nr)*(u^3)*f(5)/2;
t4=(4/Nr)*(u^2)*eta*(f(5)^2)*(r-1);
ff2=-(1/v)*(t1+t2+t3+t4);
dfdeta=[f(2);f(3);ff1;f(5);ff2];
end
function res = Needlebc(f0,finf)
a=0.2;e=0.3;
res = [f0(1)-(a*e/2)
f0(2)-e/2
finf(2)-(1-e)/2
f0(4)-1
finf(4)-0
];
end
this code doesnot show any graph. help me to plot this?

 Accepted Answer

plot(eta,f(2,:),'r')
instead of
plot(eta,f(2),'r')

More Answers (1)

plot(eta,f(2),'r')
So, what is f(2)? Is it a single number? If eta and f(2) are single numbers it should plot just a single point (marker). You need at least two points to draw a line between them.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Release

R2018b

Asked:

Nk
on 10 Feb 2023

Moved:

on 10 Feb 2023

Community Treasure Hunt

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

Start Hunting!