MATLAB: How to plot smooth curve

MATLABsmoothgarph.howto

Y=[0:25]; %lenght (m)%


L= 25; %lenght (m)%
r1=0.043; %inner radius of pipe (m)%
r2=0.045; %outer radius of pipe (m)%
rg=0.090; %radius surrounding of ground (m)%
D=0.180; %diameter pipe (m)%
AsurL=pi*D*L; %surface area (m2)%
AsurY=pi*D*Y; %area (m2)%
Tair=34; %air temperature inlet (°C)%
Tg=24; %temperature ground (°C)%
C=1007; %specific heat air (J/kg.K)%
h=37.56; %convection of heat transfer coefficient %
Rc=1./(AsurL*h); %convection resistance%
ln=@log;
Kp=0.19; %PVC pipe Thermal conductivity (W/m.K)%
Kg=0.655; %Ground thermal conductivity (W/m.K)%
Rp=(ln((r2)/r1)./(2*pi*L*Kp)); %pipe resistance%
Rg=(ln((rg)/(r2))./(2*pi*L*Kg)); %ground resistance%
Rt=Rg+Rp+Rc; %total resistance%
U=1./Rt;
m=0.21; %mass flow rate (kg/s)%



Ty1=Tg+((Tair-Tg).*exp((-U.*AsurY)./(m.*C)));
T=Tair-Ty1;
Q=m*C*T
m=0.11; %mass flow rate (kg/s)%
Ty1=Tg+((Tair-Tg).*exp((-U.*AsurY)./(m.*C)));
T=Tair-Ty1;
Q1=m*C*T
m=0.02; %mass flow rate (kg/s)%
Ty1=Tg+((Tair-Tg).*exp((-U.*AsurY)./(m.*C)));
T=Tair-Ty1;
Q3=m*C*T
m=0.05; %mass flow rate (kg/s)%
Ty1=Tg+((Tair-Tg).*exp((-U.*AsurY)./(m.*C)));
T=Tair-Ty1;
Q4=m*C*T
plot(Y,Q,Y,Q1,Y,Q3,Y,Q4)
axis([0 25 0 2500]);
ylabel('heat transfer,Q');
xlabel('pipe length');
legend('m=0.21');Y=[0:25]; %lenght (m)%

Best Answer

hello
simply increase the x axis points density
change the first two lines so you have now 10 more points in your curves - looks smoother
L= 25; %lenght (m)%

Y=linspace(0,L,250); %lenght (m)%