How do I plot a function with multiple steps
10 views (last 30 days)
Show older comments
Hello,
I am trying to plot a function, Re. This function requires a size, which I have called y. How can I plot Re, with the size of y changing. It gives me a straight line. Thanks for the help, I am very new to this.
syms y z a b c
x=10
viscosity=(1.8*10^-5)
Pi=3.1415926
Densityair=1.25
Densitypart=1000
for y=(.01*10^-9):(1*10^-2)
yint=(.01*10^-9)
y=yint+(1*10^-6)
Re=(Densityair*x*y)/viscosity
fplot(Re)
end
0 Comments
Accepted Answer
VBBV
on 23 Sep 2021
syms y z a b c
x=10
viscosity=(1.8*10^-5)
Pi=3.1415926
Densityair=1.25
Densitypart=1000
y=(.01*10^-9):(0.01*10^-9+10^-6):(1*10^-2);
Re=(Densityair*x*y)/viscosity
plot(Re)
You can use simple plot function
2 Comments
VBBV
on 23 Sep 2021
syms y z a b c
x=10
viscosity=(1.8*10^-5)
Pi=3.1415926
Densityair=1.25
Densitypart=1000
y=(.01*10^-9):(0.01*10^-9+10^-6):(1*10^-2);
Ree=(Densityair*x*y)/viscosity;
plot(Ree)
syms Re
Cd=piecewise(Re<.1,(24./Re),0.1<Re<2, (24./Re).*(1+0.1875*Re+0.05625*Re.*Re.*log(2*Re)), 2<Re<500, (24./Re).*(1+.15*Re.^0.687), Re>500, 0.44)
CdY = double(subs(Cd,Re,Ree));
You can use element wise operators in your expression
More Answers (0)
See Also
Categories
Find more on Function Creation 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!