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 个评论

"Any ideas to make it work?"
Start by considering the answers and advice you were given to your earlier question:
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
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 个评论

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

Community Treasure Hunt

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

Start Hunting!

Translated by