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

SPL 4

This document summarizes an experiment on analyzing the frequency response of systems. It provides examples of calculating the frequency response of linear time-invariant systems using MATLAB code. It also shows designing FIR filters with specific parameters and plotting their magnitude and phase responses. The discussion section includes sketching frequency responses based on transfer functions and designing high pass and bandpass filters meeting given specifications.

Uploaded by

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

SPL 4

This document summarizes an experiment on analyzing the frequency response of systems. It provides examples of calculating the frequency response of linear time-invariant systems using MATLAB code. It also shows designing FIR filters with specific parameters and plotting their magnitude and phase responses. The discussion section includes sketching frequency responses based on transfer functions and designing high pass and bandpass filters meeting given specifications.

Uploaded by

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

University of Technology

Department of Communications Engineering


Optical Communication Systems Engineering Branch

Frequency Response of a System

Experiment No.4
Signal Processing Laboratory

Mousa Saad Luaibi

Third Year

Morning Study

Group (B)

Saturday, April 16, 2022


Wednesday, April 20, 2022
Signal Processing Laboratory EXP.NO.4: Frequency Response of a System

➢ Introduction
Frequency response describes the steady-state response of a system to sinusoidal inputs of
varying frequencies to be able to analyze and control systems in the frequency domain.

Example (1): Frequency response of the given LTI system (by equation form):
Magnitude Spectrum
1

0.9
clc;
0.8
num=input(‘Enter numerator vector: ‘);
0.7
den=input(‘Enter denominator vector: ‘);

Magnitude (dB)
0.6
n=input(‘Enter number of frequency points: ‘); 0.5
w=0:pi/n:pi; 0.4
h=freqz(num,den,w); 0.3
figure 0.2
plot(w/pi,abs(h)); 0.1
title(‘Magnitude Spectrum’); 0
0 0.2 0.4 0.6 0.8 1
xlabel(‘Normalized Frequency (w/pi)’); Normalized Frequency (w/pi)

ylabel(‘Magnitude (dB)’);

Example (2): Frequency response of a given sine wave: Frequency response


10

5
close all;
t=0:0.001:1; 0

s1=sin(2*pi*50*t);
N=length(s1); -5
Magnitude (dB)

f=(0:N-1)/(N); %normalized frequency


-10
S1=abs(fft(s1));
figure -15

plot(f,2*log10(S1))
title('Frequency response'); -20

xlabel('Normalized frequency');
-25
ylabel('Magnitude (dB)');
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency
Signal Processing Laboratory EXP.NO.4: Frequency Response of a System

Example 3: Design an FIR low pass filter of order 80 using a Kaiser window with β=8. Specify
a normalized cutoff frequency of 0.5π rad/sample. Display the magnitude and phase
responses of the filter.

close all;
d=designfilt('lowpassfir','FilterOrder',80,'CutoffFrequency',0.5,'Window',('kaiser',8));
freqz(d);
50
% ot try this code %
b=fir1(80,0.5,kaiser(81,8)); 0

Magnitude (dB)
freqz(b,1); -50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

-1000
Phase (degrees)

-2000

-3000

-4000

-5000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

➢ Discussion
1. Sketch the frequency response of the following LTI system:

nv=[0.1 0 0.1];
dv=1;
nfp=512;
wradian=0:4*pi/nfp:4*pi;
FR=freqz(nv,dv,wradian);
plot(wradian/pi,abs(FR));
title('Frequency Response');
xlabel('Normalized Frequency (rad/pi)');
ylabel('Magnitude (dB)');
Signal Processing Laboratory EXP.NO.4: Frequency Response of a System
Frequency Response
0.2

0.15

Magnitude (dB)
0.1

0.05

0
0 0.5 1 1.5 2 2.5 3 3.5 4
Normalized Frequency (rad/pi)

2. Find and graph the frequency response of the following transfer function with 100
frequency points:
0.2𝑠 2 + 0.3𝑠 + 1
𝐻(𝑠) = 2
𝑠 + 0.4𝑠 + 1

nv=[0.2 0.3 1];


dv=[1 0.4 1;
nfp=100;
wradian=0:4*pi/nfp:4*pi;
FR=freqz(nv,dv,wradian);
plot(wradian/pi,abs(FR));
title('Frequency Response');
xlabel('Normalized Frequency (rad/pi)');
ylabel('Magnitude (dB)');

Frequency Response
35

30

25
Magnitude (dB)

20

15

10

0
0 0.5 1 1.5 2 2.5 3 3.5 4
Normalized Frequency (rad/pi)
Signal Processing Laboratory EXP.NO.4: Frequency Response of a System

3. Design an FIR high pass filter of order 80 using a Kaiser window with β=8. Specify a
normalized cutoff frequency of 0.5π rad/sample. Display the magnitude and phase
responses of the filter.

filterorder=80;
wc=0.5;
filtertype='high';
point=81;
beta=8;
hpf=fir1(filterorder,wc,filtertype,kaiser(point,beta));
freqz(hpf);

50

0
Magnitude (dB)

-50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

1000

0
Phase (degrees)

-1000

-2000

-3000

-4000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

4. Design an FIR bandpass filter with passband between 0.35π and 0.8π rad/sample and 3
dB of ripple. The first stopband goes from 0 to 0.1π rad/sample and has an attenuation of
40 dB. The second stopband goes from 0.9π rad/sample to the Nyquist frequency and has
an attenuation of 30 dB. Compute the frequency response. Plot its magnitude in both
linear units and decibels. Highlight the passband.
Signal Processing Laboratory EXP.NO.4: Frequency Response of a System

sb=[0.1 0.9] ;
bp=[0.35 0.8];
pb=linspace(bp(1),bp(2),1e3)*pi;

bp=designfilt('bandpassfir','StopbandAttenuation1',40,'Stop
bandFrequency1',sb(1),'PassbandFrequency1',bp(1),'PassbandR
ipple',3,'PassbandFrequency2',bp(2),'StopbandFrequency2',sb
(2),'StopbandAttenuation2',30);

[h,w]=freqz(bp,1024);
hpb=freqz(bp,pb);
subplot(2,1,1);
plot(w/pi,abs(h),pb/pi,abs(hpb),'.-');
legend('Response','Pass-band');
title('Magnitude (Linear)');
subplot(2,1,2);
plot(w/pi,20*log10(h),pb/pi,20*log10(hpb),'.-');
title('Magnitude (dB)');
xlabel('Normalized Frequency(\times\pi rad/sample)');

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy