Having difficulty performing symbolic integral

조회 수: 4 (최근 30일)
Faraz Vossoughian
Faraz Vossoughian 2017년 12월 18일
답변: Walter Roberson 2017년 12월 20일
In my code the part im trying to calculate A0 , A1,A2 and zerolift i get the following error
Error using sym/subsindex (line 836)
Invalid indexing or function definition. Indexing must follow
MATLAB indexing. Function arguments must be symbolic variables,
and function body must be sym expression.
Error in sym/subsref (line 881)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in TEST2 (line 10)
A=int(dzdx,tetan,0,pi);"
please someone help me.
Thank you,
my code is below
zc= 0.48*xc*(xc-1)^2;%change
dzdx=diff(zc,xc);%change
xc=0.5*(1-cos(tetan));
dzdx=(12*xc*(2*xc - 2))/25 + (12*(xc - 1)^2)/25;
%A0
A=int(dzdx,tetan,0,pi);
int=A/pi;
Anot=alpha-(A)
%A1
n=1
B=int(dzdx*(cos(1*tetan)),tetan,0,pi);%first part
A1=(2/pi)*(B)
%A2
n=2
C=int(dzdx*(cos(2*tetan)),tetan,0,pi);%first part
A2=(2/pi)*(C)
%zerolift
D=int((cos(tetan)-1)*dzdx,tetan,0,pi)
alphaZ=(-1/pi)*D;

답변 (2개)

Amy
Amy 2017년 12월 20일
Faraz, I think you are running into this issue because of the following line:
int = A/pi;
Then you run into an error the next time you try calling the int function because it is " shadowed". Try renaming that variable something else and you should no longer run into the same error.

Walter Roberson
Walter Roberson 2017년 12월 20일
As I said then, do not use int as a variable name. I suggested replacement code there.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by