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 comentarios

Stephen23
Stephen23 el 18 de Ag. de 2020
"Any ideas to make it work?"
Start by considering the answers and advice you were given to your earlier question:
Hubert P
Hubert P el 18 de Ag. de 2020
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.

Iniciar sesión para comentar.

 Respuesta aceptada

Matt J
Matt J el 19 de Ag. de 2020
Editada: Matt J el 19 de Ag. de 2020
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 comentario

Hubert P
Hubert P el 20 de Ag. de 2020
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.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2015a

Preguntada:

el 18 de Ag. de 2020

Comentada:

el 20 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by