BookmarkSubscribeRSS Feed
trevi83
Calcite | Level 5

Hello all,
I have a problem with the computation of the IFFT (FFT ( x)) where x is a vector.

I made 2 tests:

test1 : 4096x1 vector , resulting
IFFT (FFT (x)) is fine.

test2 : 4000000x1 vector , resulting IFFT (FFT( x)) after about 50000 records began to be ko.

my code:

%let NN=%sysevalf(4096);

proc iml;

use temp.H_primo_test;

read all var {x} into N;

z=J(&NN,1,.);

z = fft(N);

f=J(&NN,1,.);

f= ifft(z/(&NN));

quit;

it appears that the increase in the number of records creates problems for the Fast Fourier Transform.

it's correct?

thank you!

2 REPLIES 2
Rick_SAS
SAS Super FREQ

I don't know what you are seeing or what your data are, but here is a program that correctly computes the FFT and IFFT of a signal with 4,000,000 elements. As far as I can tell, the FFT is computing correctly on this large vector:

proc iml;

NN = 4000000;

t = T(do(-10,10, 20/(NN-1)));

y = sin(t) - 2*sin(2*t) + 3*sin(3*t) + 0.1*rannor(t);

z = fft(y);

f= ifft(z/NN);

maxdiff = max(abs(y-f));

print maxdiff;

maxdiff
5.5052E-9


It's possible that your data are causing instabilities of some sort. Check to see if they are blowing up (spanning many orders of magnitude) or are widely oscilating or are otherwise degenerate.

trevi83
Calcite | Level 5

Thank you Rick.

Your maxdiff is E-9 depends on the elements of the input vector.

My vector is composed of very small values (E-3, E-6...) so the differences are consistent.

However, you confirm that SAS creates differences by calculating the IFFT(FFT))?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 2 replies
  • 2108 views
  • 0 likes
  • 2 in conversation