Symbolic Integration Problem Using Symbolic Math Toolbox
이전 댓글 표시
Dear Matlab users,
I would like to get the integral of a function symbolically in MATLAB. However, MATLAB doesn't give me the integral of this function. Do you have any advice?
Thanks in advance.
MATLAB Codes to run:
clear all; clc;
syms a q mL y nL p s b yA yU mR nR r
KK5=sin(q*pi*(mR*y+nR)/a)*cos((r*pi*(mR*y+nR))/a)*cos((2*p*pi*y)/b);
K5=simplify((-1/2)*((a*r)/(q^2-r^2)*pi)*int(KK5,y,[yA yU]))
It gives me this result:
K5 =
-(a*r*pi*int(cos((pi*r*(nR + mR*y))/a)*sin((pi*q*(nR + mR*y))/a)*cos((2*pi*p*y)/b), y, yA, yU))/(2*(q^2 - r^2))
댓글 수: 2
Walter Roberson
2022년 8월 31일
Integral with respect to which variable? You did not specify a variable of integration, so int() is going to pick one.
Note: when you syms i and syms j then the i and j that result will just be normal variables, with no connection to sqrt(-1) and no connection to coordinate axes. int() will not recognize hyperbolic functions, or possibilities of rewriting in terms of exp()
ercan duzgun
2022년 8월 31일
채택된 답변
추가 답변 (1개)
ercan duzgun
2022년 8월 31일
편집: ercan duzgun
2022년 8월 31일
댓글 수: 2
After correcting some errors in your code, I get the same result for both approaches.
format long
syms a r iv mR nR y yA yU mL nL b jv iv
KK5=sin(iv*pi*(mR*y+nR)/a)*cos(r*pi*(mR*y+nR)/a)*cos(2*jv*pi*y/b);
KKK5=int(KK5,y,yA,yU);
KKKK5=simplify(((-1/2)*((a*r)/((iv^2-r^2)*pi)))*KKK5);
num_KKK5=double(subs(KKKK5,[a r iv mR nR y yA yU mL nL b jv],[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.25 0.35 0.45 0.55]))
%method2
syms y5 p5 y55 p55 y555
Y5=sin(y5*y+p5)*cos(y55*y+p55)*cos(y555*y);
YY5=int(Y5,y,yA,yU);
YYY5=simplify(((-1/2)*((a*r)/((iv^2-r^2)*pi)))*YY5);
YYYY5=subs(YYY5,[y5 p5 y55 p55 y555],[(iv*pi*mR/a) (iv*pi*nR/a) (r*pi*mR/a) (r*pi*nR/a) (2*jv*pi/b)]);
num_YYYY5=double(subs(YYYY5,[a r iv mR nR y yA yU mL nL b jv],[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.25 0.35 0.45 0.55]))
ercan duzgun
2022년 8월 31일
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


