DSPRelated.com
Forums

real & even seq - check the symmetry property of dft in MATLAB

Started by "T.E Ravi" March 9, 2009
Hi every one,
% As per theory, if there are real even seq x[n] then it will have Xi(k) img spectrum to become zero
% for periodic even xp[n] = xp [- n] ; if L=4=x[n] seq length
% x[-1] =x[1]; x[-2]=x[2] and have to include x[0] additionally
% so that the length of the seq becomes odd . i.e., L=5 with x[0] as center point
% Instead with6 given i/p seq x[n] = [1 1 1 1 1 1]
% To check for symmetry property: given x[n] to be real & even seq
% it is enough to compute X(k) for 0 : (N / 2) if N even. ( DFT have symmetry)
% then 1+ N/2 points are unique points and the rest is symmetrically redundant
% if N is odd then X(k) can be computed for 0 : (N-1)/2 . then (N+1)/2 are unique pts and the rest are symmetrically redundant.

code:
L=6;% i/p signal seq length
x=[1 1 1 1 1 1]; % i/p seq
N=2.^(nextpow2(length(x)));%N-pt DFT
fftxt(x,N);%calculaing DFT
Numofuniquepointsl((N+1)/2);% Number of Unique Points
fftxtx(1:Numofuniquepoints);% Number of Unique Points-DFT
mxs(fftx)/length(x);% scaling fft magnitude so that is not the function of x
real(fftx);% real DFT values
imag(fftx);% imaginary DFT values
o/p:
fftx Columns 1 through 5
6.0000 -0.7071 - 1.7071i 1.0000 - 1.0000i 0.7071 + 0.2929i 0
Columns 6 through 8
0.7071 - 0.2929i 1.0000 + 1.0000i -0.7071 + 1.7071i

Numofuniquepoints = 5
fftx = 6.0000 -0.7071 - 1.7071i 1.0000 - 1.0000i 0.7071 + 0.2929i 0
mx = 1.0000 0.3080 0.2357 0.1276 0
real(fftx) = 6.0000 -0.7071 1.0000 0.7071 0
imag(fftx) = 0 -1.7071 -1.0000 0.2929 0

Now my doubt is
1.i have X(k) o/p values for 5 seq length instead of length(x[n])=6;
(whether 50% computation is saved because of removing redundancies, i.e, DFT symmetry property)
2.Imag part are not exactly zero as x[n] is of real & even seq demands imaginary spectrum to be zero.

Whether this procedure is wrong
I tried to calculate fft for Numofuniquepoints instead of N points:

code:
L=6;% i/p signal seq length
x=[1 1 1 1 1 1]; % i/p seq
N=2.^(nextpow2(length(x)));%N-pt DFT
Numofuniquepointsl((N+1)/2);% Number of Unique Points
fftxt(x,Numofuniquepoints);%calculating DFT for saving 50% computation and storage.
mxs(fftx)/length(x);% scaling fft magnitude so that is not the function of x
real(fftx);% real DFT values
imag(fftx);% imaginary DFT values
o/p:
fftx = 5 0 0 0 0
mx= 5 0 0 0 0
real(fftx)= 5 0 0 0 0
imag(x) = 0 0 0 0 0


Which one is correct ???

Thank You.