Home:ALL Converter>Manipulating Fourier coefficients

Manipulating Fourier coefficients

Ask Time:2015-12-07T03:56:29         Author:darren

Json Formatter

I have calculated the coefficients of the discrete Fourier transform of a function. I have also created an array of N=1000 elements containing 1000 equally spaced samples from a single cycle of a square wave.

here is my code

 F=zeros(1000)
 F[0:500]=1
 F[500:1000]=-1
 a = rfft(F)
 print a

How do I set all but the first 10 Fourier coefficients to zero ?

Author:darren,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34121947/manipulating-fourier-coefficients
yy