Why am i getting the same error while plotting a function?

조회 수: 2 (최근 30일)
Sarbhanu Saha
Sarbhanu Saha 2021년 7월 31일
편집: G A 2021년 8월 26일
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]);
  댓글 수: 2
darova
darova 2021년 8월 1일
Show original formulas
Sarbhanu Saha
Sarbhanu Saha 2021년 8월 26일
Sorry but i don't understand what you mean to say. In the question, i did give the whole formula. But if you want the actual formula in one part, then the below one is that.
z = exp(a*r)*((r-ri)^2)*((r-ro)^2)*cos(n*(tan(b)*log(ri/r) + phi))/(r^m);
Mkrit = (pi*vpaintegral(vpaintegral((D*((diff(z,r,2) + (1/r)*diff(z,r) + (1/r^2)*diff(z,phi,2))^2 + 2*(1-u)*(((1/r)*diff(diff(z,r),phi) - (1/r^2)*diff(z,phi))^2 - diff(z,r,2)*((1/r)*diff(z,r) + (1/r^2)*diff(z,phi,2)))))*r,r,[ri ro]),phi,[0 2*pi]))/((-1)*vpaintegral(vpaintegral(((1/r^3)*diff(z,r)*diff(z,phi))*r,r,[ri ro]),phi,[0 2*pi]));
q = abs(Mkrit);

댓글을 달려면 로그인하십시오.

답변 (1개)

G A
G A 2021년 8월 26일
편집: G A 2021년 8월 26일
doc vpaintegral
vpaintegral(f,a,b) numerically approximates f from a to b.
vpaintegral(f,[a b]) is equal to vpaintegral(f,a,b).
vpaintegral(f,x,a,b) performs numerical integration using the integration variable x.
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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by