0% found this document useful (0 votes)
148 views34 pages

MATLAB Signal Processing Experiments

The document describes a list of signal processing experiments to be conducted using MATLAB/equivalent software: 1. The experiments include generation of discrete-time sequences, linear and circular convolutions, frequency analysis using DFT, design of FIR and IIR filters, and demonstrating the filtering operations. 2. It provides the index, list of experiments with page numbers and signature columns to record details of experiments conducted. 3. The introduction explains that MATLAB is a software package for numerical computation, visualization and contains built-in functions for technical computation, graphics and animation. It allows processing of variables with built-in routines and creation of functions to automate tasks.
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)
148 views34 pages

MATLAB Signal Processing Experiments

The document describes a list of signal processing experiments to be conducted using MATLAB/equivalent software: 1. The experiments include generation of discrete-time sequences, linear and circular convolutions, frequency analysis using DFT, design of FIR and IIR filters, and demonstrating the filtering operations. 2. It provides the index, list of experiments with page numbers and signature columns to record details of experiments conducted. 3. The introduction explains that MATLAB is a software package for numerical computation, visualization and contains built-in functions for technical computation, graphics and animation. It allows processing of variables with built-in routines and creation of functions to automate tasks.
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

SIGNAL PROCESSING LABORATORY

LIST OF EXPERIMENTS:

MATLAB / EQUIVALENT SOFTWARE PACKAGE

1. Generation of elementary Discrete-Time sequences


2. Linear and Circular convolutions
3. Auto correlation and Cross Correlation
4. Frequency Analysis using DFT
5. Design of FIR filters (LPF/HPF/BPF/BSF) and demonstrates the filtering operation
6. Design of Butterworth and Chebyshev IIR filters (LPF/HPF/BPF/BSF) and demonstrate the filtering operations
INDEX
LIST OF EXPERIMENTS

S. No Date Name of the Experiment Page no Marks Signature

1 Generation of Discrete Time Signals

2 Correlation of Sequences

3 Linear and Circular Convolutions

4 Spectrum Analysis using DFT

Design of FIR Filters


5a
(rectangular window design)
Design of FIR Filters
5b
(Hanning window design)

6a Design of IIR Butterworth Filters

6b Design of IIR Chebyshev Filters


INTRODUCTION

MATLAB is a software package for high performance numerical computation


and visualization provides an interactive environment with hundreds of a built in
functions for technical computation, graphics and animation. The MATLAB name
stands for Matrix laboratory.

At its core, MATLAB is essentially a set (a “toolbox”) of routines (called “m files” or


“mex files”) that sit on your computer and a window that allows you to create new variables
with names (e.g. voltage and time) and process those variables with any of those routines
(e.g. plot voltage against time, find the largest voltage, etc).

It also allows you to put a list of your processing requests together in a file and save
that combined list with a name so that you can run all of those commands in the same
order at some later time. Furthermore, it allows you to run such lists of commands such
that you pass in data. and/or get data back out (i.e. the list of commands is like a
function in most programming languages). Once you save a function, it becomes part of
your toolbox. For those with computer programming backgrounds: Note that MATLAB
runs as an interpretive language (like the old BASIC). That is, it does not need to be
compiled. It simply reads through each line of the function, executes it, and then goes
on to the next line.
Ex. No: 1
Date :
GENERATION OF DISCRETE TIME SIGNALS

AIM:

To generate a discrete time signal sequence (Unit step, Unit ramp, Sine, Cosine,
Exponential, Unit impulse) using MATLAB function.

APPARATUS REQUIRED:

HARDWARE : Personal

Computer SOFTWARE: MATLAB


PROCEDURE:

1. Start the MATLAB program.


2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8. Stop the program.

PROGRAMS: (GENERATION OF BASIC SIGNALS)

%Program for generation of unit impulse signal


t=-[Link];
y=[zeros(1,3),ones(1,1),zeros(1,3)];
Subplot (2, 2,1);
stem (t,y);
ylabel('amplitude');
xlabel('time period');
title('unit impulse')

%Program for generation of unit step signal


n=input('enter the sample length of unit step sequence');
t=[Link]n-1;
y=ones(1,n);
subplot(2,2,2);
stem(t,y);
ylabel('amplitude');
xlabel('sequence');
title('unit step')
%Program for generation of unit ramp signal
n1=input('enter the sample length of unit ramp sequence');
t=0:n1;
subplot(2,2,3);
stem(t,t);
ylabel('amplitude');
xlabel('sequence');
title('unit ramp')

%Program for generation of discrete exponential signal:


n2=input('enter the length of the exponential sequence');
t=0:n2;
a=input('enter the a value');
y2=exp(a*t);
subplot(2,2,4);
stem(t,y2);
ylabel('amplitude');
xlabel('time period');
title('exponential sequence')

%Program for generation of continuous exponential signal:


n3=input('enter the length of the exponential sequence');
t=[Link]n3-1;
a=input('enter the a value');
y3=exp(a*t);
subplot(3,1,1);
stem(t,y3);
ylabel('amplitude');
xlabel('time period');
title('continuous exponential sequence')

%Program for generation of sine wave


t=0:0.01: pi;
y=sin(2*pi*t);
subplot(3,1,2);
stem(t,y);
ylabel('amplitude');
xlabel('time period');
title('sine wave')

%Program for generation of cosine wave


t=0:0.01: pi;
y=cos(2*pi*t);
subplot(3,1,3);
stem(t,y);
ylabel('amplitude');
xlabel('time period');
title('cosine wave')
OUTPUT: (DISCRETE SIGNALS)
Enter the sample length of unit step sequence 8
Enter the length of ramp sequence 6
Enter the length of the exponential sequence 8
Enter the a value 5

unit impulse unit step


1 1
amplitude

amplitude
0.5 0.5

0 0
-4 -2 0 2 4 0 2 4 6 8
time period sequence
unit ramp 17
x 10 exponential sequence
6 3

4 2
amplitude

amplitude

2 1

0 0
0 2 4 6 0 2 4 6 8
sequence time period
OUTPUT: (CONTINUOUS SIGNALS)

Enter the length of continuous exponential sequence 10


Enter the a value 5

17
x 10 continuous exponential sequence
3
amplitude

0
0 1 2 3 4 5 6 7 8
time period
sine wave
1
amplitude

-1
0 0.5 1 1.5 2 2.5 3 3.5
time period
cosine wave
1
amplitude

-1
0 0.5 1 1.5 2 2.5 3 3.5
time period

RESULT:
Thus the MATLAB programs for discrete time signal sequence (Unit step,
Unit ramp, Sine, Cosine, Exponential, Unit impulse) using MATLAB function written
and the results were plotted.
Ex. No: 2
Date:

CORRELATION OF SEQUENCES
AIM:

To write MATLAB programs for auto correlation and cross correlation.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB R2014a

PROCEDURE:

1. Start the MATLAB program.

2. Open new M-file

3. Type the program

4. Save in current directory

5. Compile and Run the program

6. If any error occurs in the program correct the error and run it again

7. For the output see command window\ Figure window

8. Stop the program.


PROGRAM: (Cross-Correlation of the Sequences)
clc;
clear all;
close all;
x=input('Enter the sequence 1: ');
h=input('Enter the sequence 2: ');
y=xcorr(x,h);
figure;
subplot(3,1,1);
stem(x);
xlabel('n->');
ylabel('Amplitude->');
title('Input sequence 1');
subplot(3,1,2);
stem(fliplr(y));
stem(h);
xlabel('n->');
ylabel('Amplitude->');
title('Input sequence 2');
subplot(3,1,3);
stem(fliplr(y));
xlabel('n->');
ylabel('Amplitude->');
title('Output sequence');
disp('The resultant is');
fliplr(y);

OUTPUT: (Cross-Correlation of the Sequences)


Enter the sequence 1: [1 3 5 7]
Enter the sequence 2: [2 4 6 8]
PROGRAM: (Auto Correlation Function)
clc;
close all;
clear all;
x=input('Enter the sequence 1: ');
y=xcorr(x,x);
figure;
subplot(2,1,1);
stem(x);
ylabel('Amplitude->');
xlabel('n->');
title('Input sequence');
subplot(2,1,2);
stem(fliplr(y));
ylabel('amplitude');
xlabel('n->');
title('Output sequence');
disp('the resultant is ');
fliplr(y);

OUTPUT: (Auto Correlation Function)

Enter the sequence [1 2 3 4]

RESULT:
Thus the MATLAB programs for auto correlation and cross correlation
written and the results were plotted.
Ex. No: 3
Date:

LINEAR AND CIRCULAR CONVOLUTIONS


AIM:

To write MATLAB programs to find out the linear convolution and Circular
convolution of two sequences.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB R2014a

PROCEDURE:

1. Start the MATLAB program.

2. Open new M-file

3. Type the program

4. Save in current directory

5. Compile and Run the program

6. If any error occurs in the program correct the error and run it again

7. For the output see command window\ Figure window

8. Stop the program.


%Program for linear convolution
%to get the input sequence
n1=input('enter the length of input sequence');
n2=input('enter the length of impulse sequence');
x=input('enter the input sequence');
h=input('enter the impulse sequence');

%convolution operation
y=conv(x,h);
%to plot the signal
subplot(3,1,1);
stem(x);
ylabel('amplitude');
xlabel('n1....>');
title('input sequence')
subplot(3,1,2);
stem(h);
ylabel('amplitude');
xlabel('n2....>');
title('impulse signal')
subplot(3,1,3);
stem(y);
ylabel('amplitude');
xlabel('n3');
disp('the resultant signal is');y
%circular convolution
clc;
clear all;
close all;
%to get the input sequence
g=input('enter the input sequence');
h=input('enter the impulse sequence');
N1=length(g);
N2=length(h);
N=max(N1,N2);
N3=N1-N2
%loop for getting equal length sequence
if(N3>=0)
h=[h,zeros(1,N3)];
else
g=[g,zeros(1,-N3)];
end
%computation of circular convoluted sequence
for n=1:N;
y(n)=0;
for i=1:N;
j=n-i+1;
if(j<=0)
j=N+j;
end
y(n)=y(n)+g(i)*h(j);
end
end
figure;
subplot(3,1,1);
stem(g);
ylabel('amplitude');
xlabel('n1..>');
title('input sequence')
subplot(3,1,2);
stem(h);
ylabel('amplitude');
xlabel('n2');
title('impulse sequence')
subplot(3,1,3);
stem(y);
ylabel('amplitude');
xlabel('n3');
disp('the resultant signal is');
OUTPUT : LINEAR CONVOLUTION
Enter the length of input sequence 4
Enter the length of impulse sequence 4
Enter the input sequence [1 2 3 4]
Enter the impulse sequence [4 3 2 1]

The resultant signal is


y= 4 11 20 30 20 11 4

input sequence
4
amlitude

0
1 1.5 2 2.5 3 3.5 4
n1....>
impulse signal
4
amlitude

0
1 1.5 2 2.5 3 3.5 4
n2....>

40
amlitude

20

0
1 2 3 4 5 6 7
n3
OUTPUT : CIRCULAR CONVOLUTION
Enter the input sequence [1 2 2 1]
Enter the impulse sequence [4 3 2 1]

The resultant signal is


y= 15 17 15 13

input sequence
2
amplitude

0
1 1.5 2 2.5 3 3.5 4
n1..>
impulse sequence
4
amplitude

0
1 1.5 2 2.5 3 3.5 4
n2

20
amplitude

10

0
1 1.5 2 2.5 3 3.5 4
n3
RESULT:
Thus the MATLAB programs for linear convolution and circular convolution
written and the results were plotted.
Ex. No: 4
Date:
FREQUENCY ANALYSIS USING DFT
AIM:
To write MATLAB program for Frequency analyzing signal using DFT.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB

PROCEDURE:

9. Start the MATLAB program.

10. Open new M-file

11. Type the program

12. Save in current directory

13. Compile and Run the program

14. If any error occurs in the program correct the error and run it again

15. For the output see command window\ Figure window

16. Stop the program.

PROGRAM: (COMPUTATION OF FFT OF A SIGNAL)


%program for computation of fft
Clear all;
Close all;
xn=input('enter the input sequence');
n=input ('enter the number of points in fft');
l=length (xn);
if (n<1)
disp (n>=1);
end
xk=fft(xn,n);
stem(xk);
xlabel('real axis');
ylabel('imaginary axis');
title('fft');
disp('the values....');xk
OUTPUT: (FFT)
Enter the input sequence [2 1 2 1 2 1 2 1]
Enter the number of points in fft 8
The values ….
Xk= 12 0 0 0 4 0 0 0

fft
12

10

8
imaginary axis

0
1 2 3 4 5 6 7 8
real axis
PROGRAM: (Spectrum Analysis Using DFT)
N=input('type length of DFT= ');
T=input('type sampling period= ');
freq=input('type the sinusoidal freq= ');
k=0:N-1;
f=sin(2*pi*freq*1/T*k);
F=fft(f); stem(k,abs(F));
grid on; xlabel('k');
ylabel('X(k)');

INPUT:
type length of DFT=32 type
sampling period=64
type the sinusoidal freq=11

OUTPUT: (Spectrum Analysis Using DFT)

RESULT:

Thus the Spectrum Analysis of the signal using DFT is obtained using MATLAB.
Ex. No: 5a
Date:

DESIGN OF FIR FILTERS


AIM: (RECTANGULAR WINDOW DESIGN)

To write a program to design the FIR low pass, High pass, Band pass and Band
stop filters using RECTANGULAR window and find out the response of the filter by
using MATLAB.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB R2014a

PROCEDURE:
1. Start the MATLAB program.

2. Open new M-file

3. Type the program

4. Save in current directory

5. Compile and Run the program

6. If any error occurs in the program correct the error and run it again

7. For the output see command window\ Figure window

8. Stop the program.


PROGRAM: (Rectangular Window)
%program for the design of FIR low pass, high pass, band pass and band stop
filter using rectangular window
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband frequency');
fs=input('enter the stopband frequency');
f=input('enter the sampling frequency');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end;
y=boxcar(n1);
%lowpass filter
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
ylabel('gain in db....>');
xlabel('(a)normalized frequency.....>');

%highpass filter
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('gain in db......>');
xlabel('(b)normalized frequency......>');
%bandpass filter
wn=[wp ws];0
b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('gain in db....>');
xlabel('(c)normalized frequency....>');
%bandstop filter
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('gain in db....>');
xlabel('(d)normalized frequency.....>');

OUTPUT: (Rectangular Window)


Enter the pass band ripple 0.03
Enter the stop band ripple 0.01
Enter the pass band frequency 1400
Enter the stop band frequency 2000
Enter the sampling frequency 8000

MAGNITUDE RESPONSE OF MAGNITUDE RESPONSE OF HPF


G a in in d

G a in in d
b--------.

b--------.
LPF 50 50

0 0

-50 -50

-100 -100
0 0.5 1 0 0.5 1
Normalized freqency------> Normalized freqency------>
MAGNITUDE RESPONSE OF MAGNITUDE RESPONSE OF BSF
G a in in d

G a in in d

BPF 50
b--------.

b--------.

20

0
0
-20
-50
-40

-100 -60
0 0.5 1 0 0.5 1
Normalized freqency------> Normalized freqency------>

RESULT:
Thus the program to design FIR low pass, high pass, band pass and band stop
Filters using RECTANGULAR Window was written and response of the filter using
MATLAB was executed.
Ex. No: 5b
Date:
DESIGN OF FIR FILTERS
(HANNING WINDOW DESIGN)
AIM:

To write a program to design the FIR low pass, High pass, Band pass and
Band stop filters using HANNING window and find out the response of the filter by
using MATLAB.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB R2014a

PROCEDURE:
1. Start the MATLAB program.

2. Open new M-file

3. Type the program

4. Save in current directory

5. Compile and Run the program

6. If any error occurs in the program correct the error and run it again

7. For the output see command window\ Figure window

8. Stop the program.


PROGRAM: (Hanning Window)
%program for the design of FIR lowpass, high pass, band pass, band stop filter
using hanning window
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband frequency');
fs=input('enter the stopband frequency');
f=input('enter the sampling frequency');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end;
Y=hanning(n1);

%lowpass filter
b=fir1(n,wp,Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
ylabel('gain in db....>');
xlabel('(a)normalized frequency');

%highpass filter
b=fir1(n,wp,'high',Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('gain in db...>');
xlabel('(b)normalized frequency...>');

%bandpass filter
wn=[wp ws];
b=fir1(n,wn,Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('gain in db.....>');
xlabel('(c)normalized frequency....>');
%bandstop filter
b=fir1(n,wn,'stop',Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('gain in db...>');
xlabel('(d)normalized frequency....>')

FIR : ( HAMMING WINDOW)

Enter the pass band ripple 0.03


Enter the stop band ripple 0.01
Enter the pass band frequency 1400
Enter the stop band frequency 2000
Enter the sampling frequency 8000
Gain in db--------.

Gain in db--------.
MAGNITUDE RESPONSE OF LPF MAGNITUDE RESPONSE OF HPF
50 50

0
0
-50

-100 -50

-150 -100
0 0.5 1 0 0.5 1
Gain in db--------.

Gain in db--------.

Normalized freqency------> Normalized freqency------>


MAGNITUDE RESPONSE OF BPF MAGNITUDE RESPONSE OF BSF
0 5

0
-50
-5

-100 -10
0 0.5 1 0 0.5 1
Normalized freqency------> Normalized freqency------>

RESULT:
Thus the program to design FIR low pass, high pass, band pass and
band stop Filters using HANNING Window was written and response of the
filter using MATLAB was executed.
Ex. No: 6

Date:
DESIGN OF IIR FILTERS
AIM:
To write a program to design the IIR Butterworth & Chebyshew Filter (LPF/HPF/BPF/BSF) by
using MATLAB.

APPARATUS REQUIRED:

HARDWARE : Personal Computer

SOFTWARE : MATLAB R2014a

PROCEDURE:
1. Start the MATLAB program.

2. Open new M-file

3. Type the program

4. Save in current directory

5. Compile and Run the program

6. If any error occurs in the program correct the error and run it again

7. For the output see command window\ Figure window

8. Stop the program.

PROGRAM: (IIR Butterworth Filter)

PROGRAMS: IIR (BUTTERWORTH FILTER)


% Butterworth filter
% get the input values
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband frequency');
ws=input('enter the stopband frequency');
fs=input('enter the sampling frequency');
w1=2*wp/fs;
w2=2*ws/fs;
%filter order
[n,wn]=buttord(w1,w2,rp,rs);
%lowpass filter
%either coefficient
[b,a]=butter(n,wn);
%frequency response
[h,w]=freqz(b,a,512);
subplot(2,2,1);
plot(w,abs(h));
xlabel('normalized frequency');
ylabel('abs(h)');
title('lpf')

%high pass filter


%filter coefficient
[b,a]=butter (n,wn,'high');
%frequency response
[h,w]=freqz(b,a,512);
subplot(2,2,2);
plot(w,abs(h));
xlabel('normalised frquency');
ylabel('abs(h)');
title('hpf')

%band pass filter


%filter coefficient
wn1=[w1 w2];
[b,a]=butter(n,wn1);
%frequency response
[h,w]=freqz(b,a,512);
subplot(2,2,3);
plot(w,abs(h));
xlabel('normalised frequency');
ylabel('abs(h)');
title('bpf')

%band pass filter


%filter coefficient
wn2=[w1 w2];
[b,a]=butter(n,wn2,'stop');
%frequency response
[h,w]=freqz(b,a,512);
subplot(2,2,4);
plot(w,abs(h));
xlabel('normalised frequency');
ylabel('abs(h)');
title('bsf')
IIR : (BUTTERWORTH FILTER)
Enter the pass band ripple 6
Enter the stop band ripple 25
Enter the pass band frequency 1300
Enter the stop band frequency 3000
Enter the sampling frequency 8000

lpf hpf
1 1
abs(h)

abs(h)
0.5 0.5

0 0
0 1 2 3 4 0 1 2 3 4
normalized frequency normalised frquency
bpf bsf
1 1
abs(h)

abs(h)

0.5 0.5

0 0
0 1 2 3 4 0 1 2 3 4
normalised frequency normalised frequency
PROGRAMS: IIR (CHEBYSHEW FILTER)
% chebyshew filter
% get the input values
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband frequency');
ws=input('enter the stopband frequency');
fs=input('enter the sampling frequency');
w1=2*wp/fs;
w2=2*ws/fs;
%filter order
[n,wn]=cheb1ord(w1,w2,rp,rs);
%lowpass filter
%either coefficient
[b,a]=cheby1(n,rp,wn);
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,1);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('LPF')
%high pass filter
%filter coefficient
[b,a]=cheby1(n,rp,wn,'High');
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,2);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('HPF')
%band pass filter
%filter coefficient
wn1=[w1,w2];
[b,a]=cheby1(n,rp,wn1);
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,3);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('BPF')
%band stop filter
%filter coefficient
wn2= [w1, w2];
%frequency response
[b,a]=cheby1(n,rp,wn2,'stop');
[H,w]=freqz(b,a,512);
subplot(2,2,4);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('BSF')

IIR : (CHEBYSHEW FILTER)


Enter the pass band ripple 6
Enter the stop band ripple 25
Enter the pass band frequency 1300
Enter the stop band frequency 3000
Enter the sampling frequency 8000

LPF HPF
1 1
abs(H)

abs(H)
0.5 0.5

0 0
0 1 2 3 4 0 1 2 3 4
normalised frequency normalised frequency
BPF BSF
1 1
abs(H)

abs(H)

0.5 0.5

0 0
0 1 2 3 4 0 1 2 3 4
normalised frequency normalised frequency

RESULT:
Thus the program to design IIR Butterworth & Chebyshew Filter (LPF/HPF/BPF/BSF) by
using MATLAB was executed.

Common questions

Powered by AI

Butterworth filters in MATLAB are designed for a flat frequency response in the passband with no ripples, which makes them ideal for applications requiring smooth response. They are generally used when a monotonic decrease in gain away from the passband is acceptable. On the other hand, Chebyshev filters, specifically Type I as implemented, allow for ripple in the passband which can be controlled. This feature is achieved by approximating the passband characteristics using Chebyshev polynomials, which allow for a steeper roll-off than Butterworth filters. The choice between these filters depends on the application requirements for ripple and roll-off rate trade-offs in the passband and transition regions .

In the context of filter design using MATLAB, 'normalized frequency' is a dimensionless measure that relates a frequency of interest to a reference frequency, typically the Nyquist frequency, which is half of the sampling rate. This measure is significant because it allows frequency specifications to be expressed independently of the actual sampling rate, providing a consistent framework for understanding and comparing the frequency response of filters. For example, when designing filters like FIR and IIR filters, using normalized frequency ensures that designed filters can be easily adapted if the sampling rate changes .

In MATLAB, discrete-time sequences are visualized using plots that connect discrete points, commonly using the 'stem' function, which clearly shows the amplitude at each specific time instant. Continuous-time sequences, however, are visualized more smoothly, typically using the 'plot' function, representing the signal as a continuous curve over time. This distinction is necessary as discrete and continuous signals have inherently different properties and interpretations in signal processing. The document demonstrates discrete visualization through stem plots for sequences like unit impulse and unit step and continuous plots for signals like sine and cosine waves .

Personal computers play a critical role as the primary hardware required for implementing MATLAB-based experiments. These computers provide the computational resources needed to run MATLAB, allowing execution of complex numerical computations, graphical visualizations, and animations integral to signal processing tasks such as generation of signals, filtering, convolution operations, and correlation analysis. The accessibility and power of personal computers, combined with MATLAB's capabilities, enable efficient development and testing of signal processing algorithms and techniques .

The general steps involved in performing frequency analysis using DFT in MATLAB include: First, initializing MATLAB and opening a new M-file. Second, inputting the discrete signal to be analyzed and specifying the number of points for the FFT. After entering these parameters, the 'fft' function is used to compute the Fourier Transform. Finally, the result is visualized by plotting the magnitude of the FFT output, which provides insights into the frequency components of the signal. This process is crucial for understanding the spectral characteristics of signals, enabling the design and analysis of electronic filters .

Auto-correlation and cross-correlation are processes in signal processing that measure signal similarity. Auto-correlation involves correlating a signal with itself at different time lags, which helps identify repeating patterns or periodic signals within the data. Cross-correlation involves two different signals and measures the similarity or the time shift at which peak correlation occurs. These processes are crucial for applications like feature recognition, signal alignment, and noise reduction. In MATLAB, these can be implemented using the 'xcorr' function, as described in the document, which outputs both the correlation values and visualizations through plotting functions .

MATLAB is chosen for signal processing tasks due to its powerful numerical computation and extensive library functions specifically designed for technical computations, graphics, and visualization. It offers an interactive environment that allows easy manipulation of matrix-based computations and visualization, making it ideal for designing, analyzing, and simulating signal processing tasks. Furthermore, MATLAB's interpretive nature allows for rapid prototyping and testing without the need for compiling, thereby accelerating development cycles and ease of debugging .

The design approach of FIR filters using the Rectangular window in MATLAB differs from the Hanning window primarily in the windowing technique applied to control spectral leakage. The Rectangular window is a simple and direct approach without smoothing at the edges, which can lead to significant spectral leakage and less stopband attenuation. The Hanning window, on the other hand, tapers smoothly at the edges, reducing spectral leakage and improving the filter responses, particularly roll-off rates. These differences affect the frequency response of the filters, and using different windows can yield variations in passband and stopband characteristics such as ripple and attenuation, as these effects are evident in the magnitude response plots from the MATLAB implementations .

In MATLAB, the auto-correlation function is plotted by calculating correlation values using the 'xcorr' function and visualizing the result with a stem or plot graph, highlighting the correlation at various lags. This visualization helps convey the level of similarity of the signal with itself over different time shifts, which can be critical in identifying periodicity or specific patterns within the signal. The plotted output provides insight into how a signal changes over time and the alignment of its time-shifted versions, thus assisting in tasks such as feature extraction and analysis .

In MATLAB, when handling input sequences for linear convolution, it is typical to use the 'conv' function, which assumes zero-padding to ensure the output sequence is the sum of lengths of the input sequences minus one. In contrast, circular convolution assumes periodic signal continuation, requiring the lengths of input sequences to be equalized before computation. This is done by padding the shorter sequence with zeros to match the longer sequence, as seen in the loop which checks and adjusts the lengths of sequences before performing the circular convolution .

You might also like