フィルターのクリア

Solve triple integral of a function that upload its value every step

1 回表示 (過去 30 日間)
Luigi Stragapede
Luigi Stragapede 2020 年 7 月 14 日
コメント済み: Walter Roberson 2020 年 7 月 17 日
I have to solve this TRIPLE integral:
P_4=integral3(fun_r,R1,R2,0,tau,z3,z4);
In order to solve this integral, it is NECESSARY to use a function handle.
So:
fun_r=@(R, theta, z) abs(Jr4)^2*R;
The problem is that fun_r depends on Jr4 but Jr4 uploads its value at each iteration, summing all the previous values (it is a summation).
If I consider Jr4 (computed only for the current iteration) and I put it immediately inside the brackets in fun_r, it works.
But I need to make the summation and in order to do so, I need to define Jr4 outside the function handle. But Jr4 depens on R,theta and z too. So I thought to do so:
syms z theta R
Xr4=A4d.*exp(gamma4.*z)+B4d.*exp(-gamma4.*z);
Jr4=real(Jr4+(real((Xr4.*(1./R).*besselj(np,alfak.*R).*exp(1i.*np.*(theta-OMEGA.*t))))));
fun_r=@(R, theta, z) abs(Jr4)^2*R;
P_4=integral3(fun_r,R1,R2,0,tau,z3,z4);
The error is:
Error using integral2Calc>integral2t/tensor (line 231)
Input function must return 'double' or 'single' values. Found 'sym'.
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral3/innerintegral (line 137)
Q1 = integral2Calc( ...
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral3 (line 121)
Q = integralCalc(@innerintegral,xmin,xmax,integralOptions);
Error in Untitled5 (line 91)
P_4=integral3(fun_r,R1,R2,0,tau,z3,z4);
  • Is it possible to overcome this problem?
Please help me.
  11 件のコメント
Luigi Stragapede
Luigi Stragapede 2020 年 7 月 17 日
thanks a lot guys. How can I help you? Could I give you points for giving me answers?
Walter Roberson
Walter Roberson 2020 年 7 月 17 日
Right at the moment, there is a problem with the Answers facility and we cannot repost our comments as Answers. That will probably be fixed in a few hours.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by