Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: fftshift
Posted:
Jan 5, 2013 12:08 AM
|
|
"maryam" wrote in message <kbkj30$hc3$1@newscl01ah.mathworks.com>... > "Greg Heath" <heath@alumni.brown.edu> wrote in message <kbinv7$4ev$1@newscl01ah.mathworks.com>... > > "maryam" wrote in message <kbie5v$29n$1@newscl01ah.mathworks.com>... > > > Hi dear friends, thanks for your reading > > > I would like to know when a vector is transformed to Fourier domain using fftshift(fft(fftshift(s))), > > > S=[t1 t2 t3 t4 ?. tn] & sampling frequency=Fr > > > result vector fftshift(fft(fftshift(s))) is equal to [0 ?.. Fr] & sampling=Fr/n or [-Fr/2 ?.. Fr/2]? > > > > If time is bipolar and xb is defined over > > > > tb = dt*[ -(N-1)/2 : (N-1)/2 ] for N odd > > tb = dt*[ -N/2 : N/2-1 ] for N even > > > > then > > > > x = ifftshift(xb); > > > > is defined over unipolar time > > > > t = dt*[ 0 : N-1]; > > > > Furthermore, > > > > X = fft(x); > > > > is defined over unipolar frequency > > > > f = df * [ 0 : N-1 ]: > > > > and > > > > Xb = fftshift(X); > > > > is defined over bipolar frequency > > > > fb = df*[ -(N-1)/2 : (N-1)/2 ]; for N odd > > fb = df*[ -N/2 : N/2-1 ]; for N even > > > > When N is even, fftshift and ifftshift are equal. In general, however, they are inverses. > > Therefore, in general, > > > > Xb = fftshift(fft(ifftshift(xb)); > > > > and > > > > xb = fftshift(ifft(ifftshift(Xb))); > > > > Alternate forms of the time and frequency intervals can be obtained by using the > > the following dual relationships of time period T and sampling frequency Fs: > > > > Fs = 1/dt, T = 1/df > > > > dt = T/N, df = Fs/N > > > > t = 0: dt : T - dt; > > > > f = 0: df : Fs - df > > > > I will let you obtain the corresponding forms for tb and fb; > > > > Hope this helps. > > > > Greg > ---------------------------------------------------------------- > Hi thanks a lot for your reply > To express clearly what I mean, I would explain my question by an example; > Assume that we have S matrix as bellow: > > ti=1.44e-4; to=1.48e-04; dt=1e-9; > m=2*ceil(.5*(to-ti)/dt); > n=linspace(0,2,600); > t=ti+(0:m-1)*dt;
WARNING!
FFT is only defined from t =[ 0 : dt : max(t) ] to f = [ 0 : df : max(f) ] IFFT is only defined from f = [ 0 : df : max(f) ] to t = [ 0 : dt : max(t) ]
Use IFFTSHIFT to shift from tb to t or from fb to f Use FFTSHIFT to shift from f to fb or t to tb
Therefore, you should redefine your t to ti+t before transforming, but you cannot use MATLAB's shift functions unless yout original t was tb.
> s=zeros(600,m); > for k=1:600 > s(k,:)=exp(i*2*pi*10e5*sqrt(3*n(k))+i*pi*t.^2); > end
What is the physical interpretation of this?? Is this a 2-D problem in (n,t) space where n is a normalized space variable? If so, why the square root? Why are you trying to use for loops instead of vectorizing??? Why didn't you use FFT2?
help FFT2 doc FFT2
> F=zeros(600,m); F2=F; > for k=1:600 > F(k,:)=fftshift(fft(fftshift(s(k,:).'))).'; > end
NO! See my post. Even if s were properly defined over tb, you would use ifftshift, not its inverse fftshift in the time domain.
> for l=1:m > F2(:,1)=fftshift(fft(fftshift(F(:,l)))); > end > No. Use ifftshift in the inner parentheses.
> and S matrix is transformed to Fourier domain independent twice
No. The two dimensional space-time function is transformed into a two dimensional wavelength-frequency space.
> what would be the values of frequencies on vertical & horizontal axis(from 0 to sampling frequency(fs) or from ?fs/2 to fs/2) when we want to show F & F2 matrix by ?imagesc? command?
Reread my previous post.
Hope this helps.
Greg
|
|
|
|