Sie sind auf Seite 1von 5

DIGITAL SIGNAL PROCESSING MAAZ HUSSAIN EE-196

SECTION: F

POST LAB 7
Question # 1
Attach plots of in lab tasks.

1
SUBMITTED TO: MS.UZMA PARVEEN
OCTOBER 12th , 2016.
DIGITAL SIGNAL PROCESSING MAAZ HUSSAIN EE-196
SECTION: F

Question # 2:
Observe the DFT magnitude plot for x (t) =sin (2ni000t) +0.5sin (2n2000t+ (3n /4))
And prove that X (0) is equal to N times x (n)'s Average value.

CODE:

clear all; close all; clc; phase=angle(round(Xk)); % Find the


t=0:.00001:10e-3; phases of individual DFT points
xt=1+sin(2*pi*1000*t)+0.5*s phase=(phase.*180)/pi;
in(2*pi*2000*t+(3*pi/4)); %code block to plot the phase
N=80; % Length of spectrum
DFT %-------------------------
n=0:N-1; subplot(413);
Fs=8000; Ts=1/Fs; stem(Fk,phase,'filled','r');
xn=1+sin(2*pi*1000*n*Ts)+0. xlabel ('Frequency (Hz)');
5*sin(2*pi*2000*n*Ts+(3*pi/ ylabel ('Phase');
4)); xlim([0 Fs])
t1 = n.*Ts;
%code block to plot the title('Phase Spectrum')
input sequence grid
subplot(411); %-------------------%Code block to
plot(t,xt,'r'); find the IDFT of the sequence
hold on % --------------
stem(t1,xn,'filled'); for n=0:N-1
xlabel ('Time (sec)'); for k=0:N-1
ylabel ('Amplitude'); iXk(n+1)=iXk(n+1)+(Xk(k+1)*exp(j*2*pi
title('Input signal') *k*n/N));
grid end
%------------------------- end
Xk=zeros(1,N); %initialize iXk=iXk./N;
an array of same size as %------------------------------------
that of input sequence -------------------------------------
iXk=zeros(1,N); %initialize ---
an array of same size as %code block to plot the time domain
that of input sequence synthesized input sequence
%code block to find the DFT %------------------------------------
of the sequence -------------------------------------
j=sqrt(-1); ---
%-------------------------- subplot(414);
- stem(t1,iXk,'filled');
for k=0:N-1 xlabel ('Time (sec)');
for n=0:N-1 ylabel ('Amplitude');

2
SUBMITTED TO: MS.UZMA PARVEEN
OCTOBER 12th , 2016.
DIGITAL SIGNAL PROCESSING MAAZ HUSSAIN EE-196
SECTION: F
Xk(k+1)=Xk(k+1)+(xn(n+1)*ex title('Synthesized Input signal from
p((-j)*2*pi*k*n/N)); IDFT')
end grid
end %proof:
%-------------------------- fprintf('- the value of X(0)(the
---- first DFT output) =
magnitude=abs(Xk); % Find %f\n',magnitude(1,1))
the magnitudes of fprintf('- the average of xn = %f
individual DFT points \n',mean2(xn))
%code block to plot the fprintf('multiplying average of x(n)
magnitude spectrum with N = %f = to
%-------------------------- X(0)\n',N*mean2(xn))
-----
k=0:N-1;
Df = Fs/N;
Fk = k.*Df; % Analysis
frequencies
subplot(412);
stem(Fk,magnitude,'filled',
'r');
xlabel ('Frequency (Hz)');
ylabel ('Magnitude');
xlim([0 Fs])
title('Magnitude Spectrum')
grid

Prove:
• The value of X(0)(the first DFT output) is 80.000000
• The average of xn is 1.000000
• multiplying average of x(n) with N is 80.000000 that is X(0)
The averaging value of x(n) gives the value of dc offset
In this case is the dc offset value is 1 and it is proved that
x(n) . N=X(0)

3
SUBMITTED TO: MS.UZMA PARVEEN
OCTOBER 12th , 2016.
DIGITAL SIGNAL PROCESSING MAAZ HUSSAIN EE-196
SECTION: F

Question # 3
Attach plots and Interpret results of Q2
PLOT:

COMMENTS:
It was observed that:

 the value of X(0)(the first DFT output) is 80.000000


 the average of xn is 1.000000
 multiplying average of x(n) with N is 80.000000 that is X(0)
The averaging value of x(n) gives the value of dc offset. In this case is the dc offset value
is 1 and it is proved that x(n) . N=X(0)

4
SUBMITTED TO: MS.UZMA PARVEEN
OCTOBER 12th , 2016.
DIGITAL SIGNAL PROCESSING MAAZ HUSSAIN EE-196
SECTION: F

5
SUBMITTED TO: MS.UZMA PARVEEN
OCTOBER 12th , 2016.

Das könnte Ihnen auch gefallen