2.21 DFT of the sampled DTFT of a time shifted sequence Now consider signal y[n]
ID: 2248242 • Letter: 2
Question
2.21 DFT of the sampled DTFT of a time shifted sequence Now consider signal y[n] = x(n-21, so that Y (z) = z-2X(Z), Q3.7 Find the 4-point IDFT of the samples Y4 of Y (e jw). Show the relationship of Y4 to X4. A small modification of the above code should work N-32 Ngrid [0:N-1]; x-(1/2)./Nand+(1/3).ANgrid:% First 32 samples, showing the rapid decay p1=1/2 p2-1/3 b1(p1+p2) b2-p1*p2; a1-b1 b 12 b1 0]; all b1 b21 M-N WM-2pi [O:M-1]/M, xM-ifft(XM) real(xM) max(abs(x-xM)) M=N/4 WM-2pi [O:M-1]/M, xMeifft(XM); real(xM) M-N/8 WM-2pi [O:M-1]/M, XM=ifft(XM); real(xM)Explanation / Answer
close all;
clear all;
xn=input('Enter the sequence x(n)'); %Get the sequence from user
ln=length(xn); %find the length of the sequence
xk=zeros(1,ln); %initilise an array of same size as that of input sequence
ixk=zeros(1,ln); %initilise an array of same size as that of input sequence
%code block to find the DFT of the sequence
%-----------------------------------------------------------
for k=0:ln-1
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln));
end
end
%------------------------------------------------------------
%code block to plot the input sequence
%------------------------------------------------------------
t=0:ln-1;
subplot(221);
stem(t,xn);
ylabel ('Amplitude');
xlabel ('Time Index');
TITLE ('Input Sequence');
%---------------------------------------------------------------
magnitude=abs(xk); % Find the magnitudes of individual DFT points
%code block to plot the magnitude response
%------------------------------------------------------------
t=0:ln-1;
subplot(222);
stem(t,magnitude);
ylabel ('Amplitude');
xlabel ('K');
TITLE ('Magnitude Response');
%------------------------------------------------------------
phase=angle(xk); % Find the phases of individual DFT points
%code block to plot the magnitude sequence
%------------------------------------------------------------
t=0:ln-1;
subplot(223);
stem(t,phase);
ylabel ('Phase');
xlabel ('K');
TITLE ('Phase Response');
%------------------------------------------------------------
% Code block to find the IDFT of the sequence
%------------------------------------------------------------
for n=0:ln-1
for k=0:ln-1
ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/ln));
end
end
ixk=ixk./ln;
%------------------------------------------------------------
%code block to plot the input sequence
%------------------------------------------------------------
t=0:ln-1;
subplot(224);
stem(t,xn);
ylabel ('Amplitude');
xlabel ('Time Index');
TITLE ('IDFT sequence');
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.