Best fit line in log-log scale
Afficher commentaires plus anciens
Hi, I want to create a straight best fit line in the first portion of the graph and I don't want a curve best fit line, what should I do? 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(X,Y,1);
y=polyval(p,X);
figure(1)
loglog(Re,f,'x','LineWidth',1)
hold on
loglog(X,y,'--')
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 Exploration and Visualization 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!

