Why am i getting the same error while plotting a function?
Afficher commentaires plus anciens
I want to create a plot for the below given function. But, I always get the same error. The code for the plotting is:
syms a m n b r s phi E D ri ro u;
ro = 80;
E = 210000;
s = 1;
u = 3./10;
D = (E.*s.^3)./(12.*(1-u.^2));
a = 0.005;
m = 1.1492;
n = 2;
b = 0.6158;
Pi = sym(pi);
assume(r >= ri);
assume(r <= ro);
ri = linspace(5, 15, 100);
z = exp(a.*r).*((r-ri).^2).*((r-ro).^2).*cos(n.*(tan(b).*log(ri./r) + phi))./(r.^m);
dzr = diff(z,r);
dzrr = diff(dzr,r);
dzp = diff(z,phi);
dzpp = diff(dzp,phi);
dzrp = diff(dzr,phi);
q2inside = ((1./r.^3).*dzr.*dzp).*r;
q2inint = vpaintegral(q2inside,phi,[0 2.*Pi]);
q2 = (-1).*vpaintegral(q2inint,r,[ri ro]);
q1inside = (D.*((dzrr + (1./r).*dzr + (1./r.^2).*dzpp).^2 + 2.*(1-u).*(((1./r).*dzrp - (1./r.^2).*dzp).^2 - dzrr.*((1./r).*dzr + (1./r.^2).*dzpp)))).*r;
q1inint = vpaintegral(q1inside,r,[ri ro]);
q1 = Pi.*vpaintegral(q1inint,phi,[0, 2.*Pi]);
Mkrit = q1./q2;
q = double(abs(Mkrit));
plot(ri, q)
The error that i am encountering is :
Operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values.
Error in sym/vpaintegral (line 182)
(isinf(b) && isempty(symvar(b)) && ~isreal(b))
Error in Graph_Try (line 23)
q2 = (-1).*vpaintegral(q2inint,r,[ri ro]);
Réponses (1)
doc vpaintegral
vpaintegral(f,[a b]) is equal to vpaintegral(f,a,b).
in all cases a and b are scalars or return scalars if they are symbolic functions or expressions
ri = linspace(5, 15, 100); is a vector
Catégories
En savoir plus sur Calculus 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!