>> W1=[1 1 1 1;1 -j -1 j;1 -1 1 -1;1 j -1 -j] W1 =

# >> W1=[1 1 1 1;1 -j -1 j;1 -1 1 -1;1 j -1 -j] W1 =

Télécharger la présentation

## >> W1=[1 1 1 1;1 -j -1 j;1 -1 1 -1;1 j -1 -j] W1 =

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. >> W1=[1 1 1 1;1 -j -1 j;1 -1 1 -1;1 j -1 -j] W1 = 1.0000 1.0000 1.0000 1.0000 1.0000 0 - 1.0000i -1.0000 0 + 1.0000i 1.0000 -1.0000 1.0000 -1.0000 1.0000 0 + 1.0000i -1.0000 0 - 1.0000i >> W2=conj(W1)/4 W2 = 0.2500 0.2500 0.2500 0.2500 0.2500 0 + 0.2500i -0.2500 0 - 0.2500i 0.2500 -0.2500 0.2500 -0.2500 0.2500 0 - 0.2500i -0.2500 0 + 0.2500i >> W1*W2 ans = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

2. function Xk=dft(xn,N) % Computes Discrete Fourier Transform %Xk: DFT coeff. array over 0<=k<=N-1 (column vector) %xn: N-point finite duration sequence (column vector) %N: Length of DFT n=[0:1:N-1]; % row vector for n k=[0:1:N-1]; % row vector for k WN=exp(-j*2*pi/N); % Wn factor nk=n'*k; %create a N by N matrix of nk values WNnk=WN.^nk; %DFT matrix Xk=WNnk*xn;

3. function xn=idft(Xk,N) % Computes Discrete Fourier Transform %Xk: DFT coeff. array over 0<=k<=N-1 (column vector) %xn: N-point finite duration sequence (column vector) %N: Length of DFT n=[0:1:N-1]; % row vector for n k=[0:1:N-1]; % row vector for k WN=exp(-j*2*pi/N); % Wn factor nk=n'*k; %create a N by N matrix of nk values WNnk=WN.^(-nk); %IDFT matrix xn=WNnk*Xk/N;

4. >> x1=[1 2 3 4]';N=4; >> X1=dft(x1,N); >> x2=idft(X1,4) x2 = 1.0000 - 0.0000i 2.0000 - 0.0000i 3.0000 - 0.0000i 4.0000 + 0.0000i

5. >> x=[1 1 1 1]';N=4;X=dft(x,N); >> w=linspace(0,2*pi,512); >> plot(w/pi,4*abs(sinc(2*w/pi)./sinc(w/2/pi))) >> hold on; plot([0:N-1]*2/N,abs(X),'ro'); >> title('N=4'); hold off

6. >> x=[1 1 1 1 zeros(1,4)]';N=8;X=dft(x,N); >> w=linspace(0,2*pi,512); >> plot(w/pi,4*abs(sinc(2*w/pi)./sinc(w/2/pi))) >> hold on; plot([0:N-1]*2/N,abs(X),'ro'); >> title('N=8'); hold off

7. >> x=[1 1 1 1 zeros(1,28)]';N=32;X=dft(x,N); >> w=linspace(0,2*pi,512); >> plot(w/pi,4*abs(sinc(2*w/pi)./sinc(w/2/pi))) >> hold on; plot([0:N-1]*2/N,abs(X),'ro'); >> title('N=32'); hold off

8. >> n=0:5000;x=cos(0.48*pi*n)+cos(0.52*pi*n); >> L=10;x1=[x(1:L) zeros(1,1024-L)]'; >> X1=dft(x1,1024); >> plot(2*[0:1023]/1024,abs(X1)); title('L=10')

9. >> n=0:5000;x=cos(0.48*pi*n)+cos(0.52*pi*n); >> L=50;x1=[x(1:L) zeros(1,1024-L)]'; >> X1=dft(x1,1024); >> plot(2*[0:1023]/1024,abs(X1)); title('L=50')

10. >> n=0:5000;x=cos(0.48*pi*n)+cos(0.52*pi*n); >> L=100;x1=[x(1:L) zeros(1,1024-L)]'; >> X1=dft(x1,1024); >> plot(2*[0:1023]/1024,abs(X1)); title('L=100')

11. >> n=0:5000;x=cos(0.48*pi*n)+cos(0.52*pi*n); >> L=1024;x1=[x(1:L) zeros(1,1024-L)]'; >> X1=dft(x1,1024); >> plot(2*[0:1023]/1024,abs(X1)); title('L=1024')

12. >> n=0:3 n = 0 1 2 3 >> mod(n-2,4) ans = 2 3 0 1 >> x=1:4 x = 1 2 3 4 >> x(mod(n-2,4)+1) ans = 3 4 1 2

13. >> n=0:10; x=10*(0.8).^n; >> y=x(mod(-n,11)+1); >> subplot(2,1,1);stem(n,x); axis([-1 11 0 11]);title('Original sequence') >> subplot(2,1,2);stem(n,y); axis([-1 11 0 11]);title('Circularly folded sequence')

14. >> X=dft(x',11);Y=dft(y',11); >> subplot(2,2,1);stem(n,real(X));title('Real[DFT[x(n)]]'); >> subplot(2,2,2);stem(n,imag(X));title('Imag[DFT[x(n)]]'); >> subplot(2,2,3);stem(n,real(Y));title('real[DFT[x((-n))11]]'); >> subplot(2,2,4);stem(n,imag(Y));title('imag[DFT[x((-n))11]]');