Errors Computing the Energy of fft

조회 수: 2 (최근 30일)
Mohammed Alsubhi
Mohammed Alsubhi 2020년 8월 5일
댓글: Mohammed Alsubhi 2020년 8월 12일
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);

채택된 답변

Aman Vyas
Aman Vyas 2020년 8월 11일
편집: Aman Vyas 2020년 8월 11일
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
Mohammed Alsubhi
Mohammed Alsubhi 2020년 8월 12일
Thank you Aman, that fixed my issue.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fractals에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by