Errors Computing the Energy of fft

2 vues (au cours des 30 derniers jours)
Mohammed Alsubhi
Mohammed Alsubhi le 5 Août 2020
Commenté : Mohammed Alsubhi le 12 Août 2020
I am trying to calculate the energy of a Fourier Transform.
gt= 3.*triangularPulse((t-0.004)/0.002)-6.*triangularPulse((t-0.002)/0.001);
Gf1=@(f) abs(fft(gt)).^2;
EGf=integral(Gf1,0,3000)
However, I keep getting the following errors:
Error using integralCalc/finalInputChecks (line 526)
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);

Réponse acceptée

Aman Vyas
Aman Vyas le 11 Août 2020
Modifié(e) : Aman Vyas le 11 Août 2020
Hi,
You can check this code. Worked fine for me.
gt= (3.*triangularPulse((t-0.004)/0.002))-(6.*triangularPulse((t-0.002)/0.001));
Gf1=@(f) abs(fft(gt)).^2;
EGf=integral(Gf1,0,3000,'ArrayValued',1)
Hope it helps !
  1 commentaire
Mohammed Alsubhi
Mohammed Alsubhi le 12 Août 2020
Thank you Aman, that fixed my issue.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fractals dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by