Problems Graphing Function: Any Help Would be Appreciated

1 view (last 30 days)
I was having problems evaluating these equations for a range of velocities (v), and for some reason it won't run the mfile. It always has problems at the equation p=(1/((r+z*tan(ang))^2))*exp((-e*f*z)/(pi*v*(r^2+z*tan(ang)))). Any help would be great.
Here is the code:
r=240;
ang=3.75*(pi/180);
e=3.33234;
f=.0617;
v=0:.1:5;
s=5.02E-9;
a=0.25;
pd=4.14E-4;
mp=1.07E-8;
cp=0.41;
tmp=1320;
tip=20;
pmp=0;
syms z;
p=(1/((r+z*tan(ang))^2))*exp((-e*f*z)/(pi*v*(r^2+z*tan(ang))));
y=((s*a)/(pi*v))*(quad(inline('p', 0, pd));
pmp=(mp*cp*(tmp-tip))/y;
plot(v, pmp)

Answers (1)

Sean de Wolski
Sean de Wolski on 21 Dec 2011
v is a vector so you need to divide by it elementwise:
p=(1/((r+z*tan(ang))^2))*exp((-e*f*z)./(pi*v*(r^2+z*tan(ang))));
Note the '.' in front of the division sign. The next line is missing a parenthesis and has another one in the wrong place, as well as the mrdivide issue solved by the '.'.
y=((s*a)./(pi*v))*(quad(inline('p'), 0, pd));

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!