Plots with different colors
Afficher commentaires plus anciens
Hi, I want to create the scatter plot with three different colours represents three different regions. I think something wrong with the for loop, can someone help me with that? Thank you.
rho=1000; %[kg/m3]
D=12.6*10^-3; %[m]
L=1.5; %[m]
miu=0.001; %[Pas]
g=9.81;
A=pi*D^2/4;
Q0=[1600,1500,1400,1300,1200,1100,1000,900,800,700,600,500,400,300,240,220,...
200,180,160,140,120,100,80,70,70,60,50,40,30,20,10];%[L/hr]
Q=Q0/(1000*3600);
%Wet-wet digital gauge
P_dpg=[20.1,17.5,15.7,13.1,11.6,9.3,8,6.5,5.3,4.1,3,2.1,1.3,0.8]; %[kPa]
%Inverted manometer
h=[6.9,5.9,5,4.1,3.2,2.6,1.8,1.3,0.7,0.5]; %[cm]
h_m=h/100;
P_mtr=rho*g*h_m;
%Capsuhelic gauge
P_cpg=[33,31,28,23,17,12,8];
P=[P_dpg.*1000,P_mtr,P_cpg];
V=Q/A;
Re=rho*V*D/miu;
f=P*D./(2*rho*L*V.^2);
X=Re(25:31);
Y=f(25:31);
p=polyfit(log(X),log(Y),1)
y=polyval(p,log(X));
figure(1)
for i=1:length(Re)
if Re(i) < 2*10^3
loglog(Re,f,'xb','LineWidth',1)
elseif Re(i)>=2*10^3 & Re(i)<=3*10^3
loglog(Re,f,'xr','LineWidth',1)
else
loglog(Re,f,'xg','LineWidth',1)
end
end
hold on
loglog(X,exp(y),'--r','LineWidth',1.5)
grid on
xlim([10^2 10^5])
ylim([0.001 0.1])
xlabel('Reynolds number Re')
ylabel('Friction factor f')
title('f vs Re')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



