need help integrating in MATLAB
이전 댓글 표시
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)
답변 (1개)
Walter Roberson
2016년 6월 6일
0 개 추천
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.
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!