Académique Documents
Professionnel Documents
Culture Documents
Student ID # 6597
ADSP LAB # 3
Submitted By :
MUDDASSAR HUSSAIN
Registration No. :
6597
Date: 05-10-2014
Qs#2. What is moving average filter, its use and what happen if we increase
the number of filter taps?
The moving average filter operates by averaging a number of points from the input signal to
produce each point in the output signal.
This filter is used in reducing random noise while retaining a sharp step response. This makes it
the premier filter for time domain encoded signal. Moving averages are used to smooth out shortterm fluctuations. If we increase the number of filter taps then filtering quality will also increase.
But computation cost will increase.
Qs#4. Can we find output of non-causal system using filter command, State
the method?
Yes we can find output of non-causal system by using filter command. The procedure of using tis
MUDDASSAR HUSSAIN
Student ID # 6597
command is same as in causal systems. The output vector y returned by filter contains samples of y[n]
on the same interval as the samples in input. Both output & input contain same number of samples. As
filter command needs some prior values of input & some priors values of output in order to compute
the first output value. The function filter assumes that these samples are zero.
Qs#5. If the LTI system in question 1 is changed from y[n] =0.5(x[n] + x[n - 1])
to y[n] =0.5(x[n] - x[n - 1]), what would be its effect on the input x[n] = s[n] +
d[n]?
If the LTI system is changed from y[n] =0.5(x[n] + x[n - 1]) to y[n] =0.5(x[n] - x[n - 1]), then
our input x[n] signal will be diminished. We get zero at the output.
Qs#6. Why the output generated by impz and filter commands varies?
By using impz command we get impulse response of system & then we convolve it with the
input. So, the output length will be length(x)+length(y)-1. On the other hand length of output of
filter command is equal to length of input signal x. Due to this output of both commands varies.
Qs#8. Find the Step Response of the following system using impz
command, N=20.
y[n]+0.71y[n1]0.46y[n2]0.62y[n3]=0.9x[n]0.45x[n1]+0.35x[n2]+0.002x[n3].
num = [0.9 -0.45 0.35 0.002];
den = [1 0.71 -0.46 -0.62];
m=impz(num,den,20);
for n=1:50
u(n)=1;
end
y=conv(m,u);
plot(y)
MUDDASSAR HUSSAIN
Student ID # 6597
Codes
Qs # 1:
(a)
s= [6 6 6 6 6 7 7 7 7 7
N=length(s);
d=0.8*(rand(1,N)-0.5);
n1=0:N-1;
n2=n1;
x=s+d;
subplot(1,3,1);
stem(n1,s);
subplot(1,3,2);
stem(n2,x);
8 8 8 8 8 ];
MUDDASSAR HUSSAIN
Student ID # 6597
(b & c)
s= [6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 8];
N=length(s);
d=0.8*(rand(1,N)-0.5);
n1=0:N-1;
n2=n1;
x=s+d;
subplot(1,3,1);
stem(n2,x);
num = [1 1 1];
den = [3 0];
h=impz(num,den);
y=conv(h,x);
subplot(1,3,2)
stem(y)
h1=filter(num,den,x);
subplot(1,3,3)
stem(h1)
MUDDASSAR HUSSAIN
Qs # 2:
n=0:40;
a=2; b=-3;
x1= cos(2*pi*0.1*n);
x2= cos(2*pi*0.4*n);
num = [2.2403 2.4908 2.2403];
den = [1 -0.4 0.75];
h=impz(num,den,20);
subplot(2,3,1);
stem(h)
y1=conv(h,x1);
subplot(2,3,2)
stem(y1)
y2=conv(h,x2);
subplot(2,3,3)
stem(y2)
x=a*x1+b*x2;
y=conv(h,x)
subplot(2,3,4)
stem(y)
y4=y1+y2;
subplot(2,3,5)
stem(y4)
y5=filter(num,den,x);
subplot(2,3,6)
stem(y5)
[z,p,k] = tf2zp(num,den)
z=
-0.5559 + 0.8312i
-0.5559 - 0.8312i
p=
0.2000 + 0.8426i
0.2000 - 0.8426i
k=
2.2403
Student ID # 6597
MUDDASSAR HUSSAIN
Student ID # 6597
Fig. 3 Outputs of Qs # 2