# Graph are not following the if statement

1 view (last 30 days)
So i want my graph to be similar to this graph.
However I had to issues. My graph goes above 100 and I have already made an if statement to set any value that goes above 100 to be = 100 but the graph isn't following it. and my second issue is that i want to scale my axies to be displayed from 0.1 to 1 in the middle and from 1 to 10 similar to the graph above.
clear
clc
format long
% Given Values
T = 298.15; % K - Given Temperture
P = 101.325 ; % kPa - Pressure
H = 1.07 *0.001; % cm
Lc = 0.894;
U = 0.135; %m/s
%Actual particle Density given.
Pp = 2060; % kg/m^3
% Guess Dp to get the correct effeciency
Dp1 = 0.1:0.1:10;
Dp = Dp1 * 10^-6;
% Standard Temperture and Mu at SATP
Ts0 = 298.15; % K
Ts = 110.4; % K
Rair = 0.287; % kJ / kg * K
Mu_s = 1.849*10^-5; % kg/m*s
g = 9.81;
% Calculate Air Density
Pa = P / (Rair * T);
% Viscosity Mu and v
Mu = Mu_s * (T/Ts0)^(3/2) * (Ts0+Ts)/(T+Ts);
v = Mu / Pa;
% lamda - Mean free path
lamda1 = (Mu/0.499) * sqrt(pi/(8*Pa*P*1000)); % Unit m
lamda = lamda1 *10^6; % Unit Mu*m
% Knudsen number
Kn = lamda1 ./ Dp;
% Cunningham Correction Factor
C = 1 + Kn .* (2.514+0.80.*exp(-0.55./Kn));
Vt_guess = (((Pp-Pa)./18).*Dp.^2.*g.*(C./Mu));
n_iterations = 0;
while n_iterations < 15
Re = (Pa.*Vt_guess.*Dp)./Mu;
Cd = (24./Re) + ((2.6.*(Re./5.0)) / (1 + (Re./5.0).^1.52)) + ((0.411.*(Re./(2.63.*10.^5)).^-7.94) ./ (1+(Re./(2.63.*10.^5)).^-8)) + ((0.25.*(Re./10.^6)) ./ (1+(Re./10.^6)));
Vt = sqrt((4./3).*((Pp-Pa)./Pa).*g.*Dp.*(C./Cd));
n_iterations = n_iterations+1;
Vt_guess = Vt;
Vt;
end
format short
Vt1 = H*U/Lc; % In this example its given to us.
nDp = (Lc*Vt)/(H*U) *100;
if nDp > 100
nDp = 100;
else
nDp = (Lc*Vt)/(H*U)*100;
end
plot (Dp1,nDp)
xlim([0 10])
ylim([0 100])

VBBV on 1 Apr 2022
Modify this part of code and check
for k = 1:length(nDp)
if nDp(k) > 100
nDp(k) = 100;
else
nDp(k) = (Lc*Vt(k))/(H*U)*100;
end
end
plot (Dp1,nDp)
xlim([0 10])
ylim([0 120])
Abdullah Alsayegh on 1 Apr 2022
Thank you so much for your quick response.