Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

American International University- Bangladesh (AIUB)

Faculty of Engineering (EEE)

Course Name : Digital Signal Processing Lab


Semester : Fall 2020-21 Sec : C
Faculty : Tahia Fahrin Karim Marks: 30

Student Name: Arafi,MD.Abdullah Student ID: 18-38134-2


Final-Term

Marking Rubrics (to be filled by Faculty)


Proficient Good Acceptable Unacceptable Secured
Category
[5-4] [3] [2] [1] Marks
Algorithm of the Algorithm of the Algorithm of the Algorithm of the issue
issue/problem to be issue/problem to be issue/problem to be /problem to be
considered critically is stated considered critically is considered critically is considered critically is stated
clearly and described stated, described, and stated, but description leaves without clarification or
Algorithm/Logic comprehensively, delivering clarified so that some terms undefined, description.
relevant information understanding is not ambiguities unexplored,
necessary for full seriously impeded by boundaries undetermined,
understanding. omissions.
Syntax of the programming Syntax of the programming Syntax of the programming Syntax of the programming
Coding/ Syntax language is most efficient language is correct and no language is 60% correct. language is erroneous.
and shortest. error is found.
Detail analysis of the Justified analysis is Relevant analysis is Analysis is irrelevant to the
problem solution is presented. described. problem solution.
Analysis presented. Correct
explanation is expected with
proper reference.
The whole report is The report is thorough, Information lacks depth. Vague, unclear.
Organization of exceptionally well-organized relevant and accurate Accurate but inadequate or Insufficient or irrelevant
the Report and very easy to understand. information to some extent. repetitive at times. information.
Total Marks
Comments:
(Out of 20 ):
DSP Lab

Problem 1:
a) Now we will study how a filter affects sinusoidal inputs, and begin to understand the performance of the filter
as a function of the input frequency. Consider the following input signal,
x(n)=Acos(ωxn+φ); for n=0, 1, 2, . . . , L–1
If the discrete-time sinusoid is produced by sampling a continuous-time cosine, the discrete time frequency is
ωx=2π(F/fs). Generate L= 50 samples of a discrete-time cosine wave with A=7, φ=π/3 and ωx=0.125π. Store this
signal in the vector x.

Now use filter( ) to implement the following filters on the signal x. [Check your ID to be sure which filter is to
be used. Students with odd serials will use (1) equation and even serials will use (2)]

1. y(n) = 5x(n) - 5x(n-1)


2. y(n) = 5x(n) + 5x(n-1)

This is called a first-difference filter, but with a gain of five. In Matlab you must define the vector ‘B’ needed in
filter( ).
 Plot the first 50 samples of both waveforms x(n) and y(n) on the same figure, using subplot. Use the
stem function to make a discrete-time signal plot.
 Verify the amplitude and phase of x(n) directly from its plot in the time domain.
 From the plot, observe that with the exception of the first sample y(0), the sequence y(n) seems to be a
scaled and shifted cosine wave of the same frequency as the input.
 Determine the amplitude and phase of y(n) directly from the plot. Ignore the first output point, y(0).
 Identify the difference between output and input phases.

b) Linearity Check:
 Now multiply the vector x from part (a) by two to get x =2*x. Generate the signal y by filtering x with
a a a

the first difference filter given.


 Now generate a new input vector x corresponding to the discrete-time signal x (n) = 8cos(0.25πn) and
b b

then filter it through the first difference operator to get y (n).


b

 Now form another input signal x that is the sum of x and x . Run x through the filter to get y and then
c a b c c

plot y . Compare yc to a plot of ya+yb. Are they equal?


c

Page - 2
DSP Lab

Even
a)
Code Output
n=0:49;
xx=7*cos((0.125*pi*n)+pi/3);
subplot(211)
stem(n,xx)
bb=[5 5];
ww=-pi:pi/100:pi;
H=freqz(bb,1,ww);
y=filter(bb,1,xx);
subplot(212)
stem(n,y)

b)
Code Output
clc;
clear all;
xa=2*xx;
ya=filter(bb,1,xa);
subplot(211)
stem(n,xa)
subplot(212)
stem(n,ya(1:50))

Problem 2
Code Output

Page - 3
DSP Lab
xb=8*cos(pi*0.25.*n);
yb=filter(bb,1,xb);
subplot(211)
stem(n,xb)
subplot(212)
stem(n,yb(1:50))

Problem 3
Code Output
xc=xa+xb;
yc=filter(bb,1,xc);
figure(1)
subplot(211)
stem(n,xc)
subplot(212)
stem(n,yc(1:50))

yc=ya+yb;
figure(2)
subplot(211)
stem(n,xc)
subplot(212)
stem(n,yc(1:50))

Page - 4

You might also like