How to Form Continuous Curve Plot
Show older comments
I have the following code. At the end, I issue the plot command. The resulting figure shows hundreds of discrete points along the plot. Is there someway to tell Matlab to connect those points to form a continuous curve, simply so the end product looks more like a curve instead of many tiny little dots?
I'm new, so please provide answers in simple terms with clear explanation, since I'm trying to learn and get a better understanding.
Thanks,
M Ridzon
%Define ratio of specific heats
gamma=1.4;
%Define gas constant
R=287; %(J/Kg/K)
%Define reservoir properties
P_Res=500; %(kPa)
T_Res=500; %(Kelvin)
%Define nozzle exit area
NozArea=50; %(cm^2)
%Find pressure ratio when nozzle exit plane becomes choked.
P_Ch=((1+((gamma-1)./2).*((1.0).^2)).^(gamma./(gamma-1))).^-1;
%From critical pressure ratio, find actual back pressure which causes choke
P_Crit=P_Res.*P_Ch; %(kPa)
%Find density of fluid in reservoir
rho_Res=P_Res.*1000./R./T_Res;
%***********************************
%Calculate m-dot for choked case
%***********************************
%Find temperature of air exiting nozzle
T_Exit_Ch=T_Res./(1+((gamma-1)./2).*((1.0).^2)); %(K)
%Find speed of sound for the given temperature
a_Exit_Ch=(gamma.*R.*T_Exit_Ch).^0.5; %(m/s)
%Find fluid density from equation of state
rho_Exit_Ch=(P_Crit.*10.^3)./R./T_Exit_Ch; %(kg/m^3)
%Find m-dot
m_dot_Ch=rho_Exit_Ch*a_Exit_Ch*NozArea*((1/100)^2); %(kg/s)
%***********************************
%Begin FOR loop
%***********************************
for i=0:P_Res/500:P_Res
if i<=P_Crit
m_dot=m_dot_Ch;
else
%Find mach speed of fluid exiting nozzle
M=((2./(gamma-1)).*((P_Res./i).^((gamma-1)./gamma)-1)).^0.5;
%Find temperature of air exiting nozzle
T_Exit_Norm=T_Res./(1+((gamma-1)./2).*(M.^2)); %(K)
%Find density of air exiting nozzle
rho_Exit_Norm=rho_Res./((1+((gamma-1)./2).*(M.^2)).^(1./(gamma-1))); %(kg/m^3)
%Find speed of sound for the given temperature
a_Exit_Norm=(gamma.*R.*T_Exit_Norm).^0.5; %(m/s)
%Find exit velocity
V_Exit_Norm=M.*a_Exit_Norm; %(m/s)
%Find m-dot
m_dot=rho_Exit_Norm*V_Exit_Norm*NozArea*((1/100)^2); %(kg/s)
end
P_Ratio=i./P_Res;
plot(P_Ratio,m_dot,'Color','k');
hold on %Hold plotting until the conclusion
end
title('Ratio of Back Pressure to Reservoir Pressure vs. Mach Number')
xlabel('Pb / Pr')
ylabel('Mach Number')
hold off
Accepted Answer
More Answers (1)
Categories
Find more on Fluid Network Interfaces Library in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!