Symbolic Integration Problem Using Symbolic Math Toolbox
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 31 Aug. 2022
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
am 31 Aug. 2022
Akzeptierte Antwort
Weitere Antworten (1)
ercan duzgun
am 31 Aug. 2022
Bearbeitet: ercan duzgun
am 31 Aug. 2022
2 Kommentare
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
am 31 Aug. 2022
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


