2017-06-22 2 views
2

私はこの積分をしばらく考えようとしていましたが、それほど短くはありませんでした。私は象徴的な統合を試みましたが、私はそれを私に返してもらったので、私はそこに解決策がないと仮定しています。私は定積分とそれを解決することを決議し、それでもエラーを得続けるいる:複雑な関数をどのように統合するのですか?

clear 
clc 

x = 1; 
y = 1; 
z = 1; 
R = 2; 

b [email protected](theta) y.*cos(theta)/((x-R.*cos(theta)).^2+y.^2+(z - 
      R.*sin(theta)).^2).^(3/2) 

integral(b,1,2) 

私の現在のエラーは、次のとおりです。

Error using integralCalc/finalInputChecks (line 515) 
Output of the function must be the same size as the input. If FUN is an array-valued 
integrand, set the 'ArrayValued' option to true. 

Error in integralCalc/iterateScalarValued (line 315) 
       finalInputChecks(x,fx); 

Error in integralCalc/vadapt (line 132) 
      [q,errbnd] = iterateScalarValued(u,tinterval,pathlen); 

Error in integralCalc (line 75) 
     [q,errbnd] = vadapt(@AtoBInvTransform,interval); 

Error in integral (line 88) 
Q = integralCalc(fun,a,b,opstruct); 

すべてのヘルプは非常にいただければ幸いです!

答えて

1

あなたはelement-wise divisionなくmatrix right divisionを行っていることを確認するために/から./に第1項の除算記号を変更する必要があります。

b = @(theta) y.*cos(theta)./((x-R.*cos(theta)).^2+y.^2+(z - ... 
      R.*sin(theta)).^2).^(3/2); 
integral(b,1,2) 

ans = 

    0.055781612354862 
関連する問題