Rank: 1244 based on 53 downloads (last 30 days) and 1 file submitted
photo

Kan Wu

E-mail
Company/University
Nanyang Tech. U. Singapore

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Kan
Updated   File Tags Downloads
(last 30 days)
Comments Rating
02 Oct 2009 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu signal processing, fast fourier transfor... 53 5
  • 4.0
4.0 | 3 ratings
Comments and Ratings by Kan View all
Updated File Comments Rating
16 May 2010 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu

To Mehta, yes you r right. ifftshift is used for sequence with odd length. Thank you for the correction!

01 Mar 2010 errorbarxy Errorbarxy allows the user to plot both horizontal and vertical errorbars. Author: James Rooney

There is a small bug. When I display legend, the original curve and errorbar are two different items. In Matlab errorbar() function, they are one curve. Hope you can modify it

28 Feb 2010 errorbarxy Customizable error bar plot in X and Y direction Author: Jean-Yves Tinevez

very good

28 Feb 2010 errorbarxy Errorbarxy allows the user to plot both horizontal and vertical errorbars. Author: James Rooney

very good

21 Oct 2009 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu
Comments and Ratings on Kan's Files View all
Updated File Comment by Comments Rating
23 May 2010 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu lanqing, zhang

thanl you very much !

18 May 2010 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu Mehta, Shalin

You're welcome. ifftshift is the same as fftshift for even length sequence, but different for odd length. So if one uses fftshift(fft(ifftshift(...))) things work well. By the way, scaling by dt and df to correct for scaling introduced by FFT algorithm is neat trick.

16 May 2010 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu Wu, Kan

To Mehta, yes you r right. ifftshift is used for sequence with odd length. Thank you for the correction!

14 May 2010 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu Mehta, Shalin

There is a problem with above recipe. It fails when you have sequence of odd length. Correct recipe is:
fftshift(fft(ifftshift(sig))) or fftshift(ifft(ifftshift(spectrum))).

A description of this can be found on my submission on fftshift, ifftshift.

To observe that above is true, run the following code with fftshift and ifftshift on inner call for computing Xfinal.
-------------------------
Bx = 50;
A = sqrt(log(2))/(2*pi*Bx);
fs = 500; %sampling frequency
dt = 1/fs; %time step
T=1; %total time window
t = -T/2:dt:T/2; %time grids
df = 1/T; %freq step
Fmax = 1/2/dt; %freq window
f=-Fmax:df:Fmax; %freq grids, not used in our examples, could be used by plot(f, X)

x = exp(-t.^2/(2*A^2));
Xan = A*sqrt(2*pi)*exp(-2*pi^2*f.^2*A^2); %X(f), analytical Fourier transform of x(t), real
Xfft = dt * fft(x); %directly using fft()
Xfftshift = dt * fft(fftshift(x)); %using fftshift() before fft()
Xfinal = dt * fftshift(fft(ifftshift(x))); %identical with analytical X(f), also note dt
subplot(211); plot(f,Xan,f,real(Xfinal),'--');
subplot(212); plot(f,imag(Xfinal));

18 Dec 2009 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu Fetterman, Matt

Very interesting!

Top Tags Applied by Kan
fast fourier transform, signal processing
Files Tagged by Kan
Updated   File Tags Downloads
(last 30 days)
Comments Rating
02 Oct 2009 Why use fftshift(fft(fftshift(x))) in Matlab instead of fft(x)? Explain why we use fftshift(fft(fftshift(x))) in Matlab instead of fft(x) Author: Kan Wu signal processing, fast fourier transfor... 53 5
  • 4.0
4.0 | 3 ratings

Contact us at files@mathworks.com