need help integrating in MATLAB
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Could anyone please tell me what's the problem in the following code?
syms x
M=1;
k1=sin(x)/(sqrt(3)*M-3*sin(x));
k2=(M*sin(x)+0.5*sin(2*x-(2*pi/3)))/(sqrt(3)*M-3*sin(x+(2*pi/3)))*(M-sin(x+pi/6));
k3=(M*sin(x)+sin(2*x+pi/3))/(sqrt(3)*M+3*sin(x+(2*pi/3)))*(M-sin(x+pi/6));
pf=2/sqrt(pi)*((int(k1*sin(x),x,0,pi/6))+(int(k2*sin(x),x,0,pi/6))+(int(k3*sin(x),x,0,pi/6)))/(sqrt((int(k1^2,x,0,pi/6))+(int(k2^2,x,0,pi/6))+(int(k3^2,x,0,pi/6))));
fplot(pf)
0 commentaires
Réponses (1)
Walter Roberson
le 6 Juin 2016
k2 has a denominator of sqrt(3)-3*cos(x+(1/6)*Pi) . That passes through 0 at x = -(1/6)*Pi+arccos((1/3)*sqrt(3)) which is between 0 and Pi/6. The integral of k2*sin(x) therefore has a pole in the range and so the integral is undefined.
Because of the pole in k2, the square of k2 goes to infinity at that location, so the integral of that part is infinity.
You also appear to be having some difficulties with the symbolic engine not being able to integrate some of the functions.
I recommend that you break your pf function up into pieces, with the integrals each done as one expression and then the final expression brings the pieces together. That will make it easier for you to debug which of the integrals are going wrong.
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!