0% found this document useful (0 votes)
35 views

DSP Lab 2

This document discusses frequency response analysis of different types of filters. It provides the theory behind calculating the frequency response of a filter using freqz. Examples are given to plot the frequency response of a low pass filter, high pass filter, and band pass filter. It also shows examples of plotting input signals. The conclusion states that different filters have different characteristics in their magnitude and phase responses which are used for different purposes in filter design.

Uploaded by

pkrsuresh2013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

DSP Lab 2

This document discusses frequency response analysis of different types of filters. It provides the theory behind calculating the frequency response of a filter using freqz. Examples are given to plot the frequency response of a low pass filter, high pass filter, and band pass filter. It also shows examples of plotting input signals. The conclusion states that different filters have different characteristics in their magnitude and phase responses which are used for different purposes in filter design.

Uploaded by

pkrsuresh2013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

LAB 2

TITLE-FREQUENCY RESPONSE OF THE DIFFERENT TYPE OF FILTER.

THEORY:

FREQZ Digital filter frequency response.


[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response
vector H and the N-point frequency vector W in radians/sample of
the filter:
jw -jw -jmw
jw B(e) b(1) + b(2)e + .... + b(m+1)e
H(e) = ---- = ------------------------------------
jw -jw -jnw
A(e) a(1) + a(2)e + .... + a(n+1)e
given numerator and denominator coefficients in vectors B and A. The
frequency response is evaluated at N points equally spaced around the
upper half of the unit circle. If N isn't specified, it defaults to
512.

[H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle.

H = FREQZ(B,A,W) returns the frequency response at frequencies


designated in vector W, in radians/sample (normally between 0 and pi).

[H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return


frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).

H = FREQZ(B,A,F,Fs) returns the complex frequency response at the


frequencies designated in vector F (in Hz), where Fs is the sampling
frequency (in Hz).

1 .Frequency response of low pass filter.

num=[0 1]
dem=[1e-3 1]
freqz(num,dem,'whole')
title('frequency response of low pass filter')

1
frequency response of low pass filter
0.01
Magnitude (dB)

0.005

-0.005

-0.01
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

0.1
Phase (degrees)

0.05

-0.05

-0.1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

Fig1. Frequency response of low pass filter.

2. Frequency response of high pass filter.

num=[0 1e-3 0]
dem=[0 1e-3 1]
freqz(num,dem,'whole')
title('frequency response of high pass filter')

2
frequency response of high pass filter
-59.98
Magnitude (dB)

-59.99

-60

-60.01
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

400
Phase (degrees)

300

200

100

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

Fig 2-Frequency response of high pass filter.

3. Frequency response of band pass filter.

num=[0 1e-3 0]
dem=[1e-6 3e-3 1]
freqz(num,dem,'whole')
title('frequency response of band pass filter')

3
frequency response of band pass filter
-59.96
Magnitude (dB)
-59.98

-60

-60.02

-60.04
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

400
Phase (degrees)

300

200

100

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Frequency ( rad/sample)

Fig 3- Frequency response of band pass filter.

4. Plot a x(n) signal.

X1=[1 1 2 3 5]
X2=[1 2 3 4 5]

x1=[1 1 2 3 5]
n=0:1:4
subplot(2,1,1)
stem(n,x1)
subplot(2,1,2)
x2=[1 2 3 4 5]
n=0:1:4
stem(n,x2)
title('plot the input signal')

4
6

0
0 0.5 1 1.5 2 2.5 3 3.5 4

plot the input signal


6

0
0 0.5 1 1.5 2 2.5 3 3.5 4

Fig 4-Plot the input signal.

CONCLUSION –We are observe and plot frequency response of different type of filter in
terms of magnitude response (in dB) and phase response (in degree).Different filter have
different charactertics which are used for different purpose in design.

You might also like