Multiple anonymous functions, result NaN

Z = @(t)(integral(@(X)((X.*(-1.94259876933865e-3)+X.^2.*9.43561288366922e-4+X.^3.*3.22493262073758e-6-X.^4.*3.33598332709698e ...
-7-X.^5.*1.316395160738724e-9+X.^6.*3.58619198487258e-11+X.^7.*2.98983988537052e-13-X.^8.*2.17709553882494e ...
-15-X.^9.*2.18502610124372e-17+X.^10.*6.47767646373618e-20+X.^11.*6.76115455690154e-22-X.^12.*7.44347608685098e ...
-25-X.^13.*7.726801093703259e-27+5.07072734540628e1)* % here ends the polynomial
* ((-295.9471041.*integral(@(x)((x.*(-1.15517395637196e-2)+x.^2.*5.25774286994568e-4-x.^3.*1.089934292266744e-5
-x.^4.*1.230239476736945e-7+x.^5.*6.42213403953954e-10 ...
+x.^6.*1.550438107746178e-11+x.^7.*3.670339539265712e-15-x.^8.*1.053763407268398e-15-x.^9.*1.00711819287645e-18 ...
+x.^10.*3.225336064282519e-20+x.^11.*1.85216906506446e-23-x.^12.*3.481067131642152e-25+2.92686659979064e-2)./(X-x)), ...
-180,180,'ArrayValued',1)-295.9471041.*integral(@(x)(-((X-t*1.028888e1+x).*(x.*(-1.15517395637196e-2) ...
+x.^2.*5.25774286994568e-4-x.^3.*1.089934292266744e-5-x.^4.*1.230239476736945e-7+x.^5.*6.42213403953954e-10 ...
+x.^6.*1.550438107746178e-11+x.^7.*3.670339539265712e-15-x.^8.*1.053763407268398e-15-x.^9.*1.00711819287645e-18 ...
+x.^10.*3.225336064282519e-20+x.^11.*1.85216906506446e-23-x.^12.*3.481067131642152e-25+2.92686659979064e-2))./((X-t*1.028888e1+x).^2 ...
+1.018379983e5)),-180,180,'ArrayValued',1)))), -180, 180, 'ArrayValued', 1))
When I pass any argument to Z() I receive
Warning: Infinite or Not-a-Number value encountered.
> In integralCalc/iterateArrayValued (line 267)
In integralCalc/vadapt (line 130)
In integralCalc (line 75)
In integral (line 88)
To make it look clearer
Z = @(t)(integral(@(X)[B(X)*p(X,t)], -180, 180, 'ArrayValued', 1))
%B(x) is a polynomial of 13th grade and p(X,t) is
p(X,t) = @(X)(integral(@(x)(-295...*integral(@(x)(.. ), -180, 180, 'ArrayValued', 1) -295..*integral(@(x)(..), -180, 180, 'ArrayValued', 1))
% and inside p(X) there are some t's
It doesn't plot anything. Any ideas to make it work?

2 件のコメント

Stephen23
Stephen23 2020 年 8 月 18 日
"Any ideas to make it work?"
Start by considering the answers and advice you were given to your earlier question:
Hubert P
Hubert P 2020 年 8 月 18 日
Well there was no advice, u only told me that it's not going to work because of loss of information and too big span between numbers and that gives me nothing.
Best regards.

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

 採用された回答

Matt J
Matt J 2020 年 8 月 19 日
編集済み: Matt J 2020 年 8 月 19 日

1 投票

You have singularities in your integrand because of things like
./((X-t*1.028888e1+x).^2
You need to be careful not to try to integrate through them.

1 件のコメント

Hubert P
Hubert P 2020 年 8 月 20 日
Not exactly this one (because in the code there is also +1.018379983e5 in the denominator).
It is the (X-x), but I really thank you for bringing up this topic.
You actually mentioned the main problem with my function.

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2015a

質問済み:

2020 年 8 月 18 日

コメント済み:

2020 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by