[go: up one dir, main page]

0% found this document useful (0 votes)
14 views26 pages

SS Lab File With Output

The document outlines a series of MATLAB-based experiments for a Signal and System course at the Indore Institute of Science and Technology. It includes detailed procedures for generating various signals, computing linear and circular convolutions, and performing Z-transforms and correlation functions. Each experiment aims to enhance understanding of signal processing concepts through practical programming exercises.

Uploaded by

Saloni Parihar
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)
14 views26 pages

SS Lab File With Output

The document outlines a series of MATLAB-based experiments for a Signal and System course at the Indore Institute of Science and Technology. It includes detailed procedures for generating various signals, computing linear and circular convolutions, and performing Z-transforms and correlation functions. Each experiment aims to enhance understanding of signal processing concepts through practical programming exercises.

Uploaded by

Saloni Parihar
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/ 26

INDORE INSTITUTE OF SCIENCE AND

TECHNOLOGY
DEPARTMENT OF
ELECTRONICS AND COMMUNICATION

SIGNAL AND SYSTEM


(EC-402)

Submitted by: Submitted to:

1
CONTENTS

INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT: SIGNAL AND SYSTEM SUBJECT CODE: EC-402


CLASS: EC 2ND Year SEMESTER –IV

S.No. NAME OF EXPERIMENT


1. Write a MATLAB based program for the different types of signal generation.

2. Write a MATLAB based program program for the generation of ‘sine’ wave and ‘cosine’
wave.

3. Write a MATLAB based program computing the Linear convolution of the input
sequences.

4. Write a MATLAB based program computing the Circular convolution of the input
sequences.

5. Write a MATLAB program for Computation and plot of Z-transform.

6. Write a MATLAB program for Computation and plot of Inverse Z-transform.

7. Write a MATLAB based program showing the implementation of ‘Auto-Correlation’


using the input sequences.

8. Write a MATLAB based program showing the implementation of ‘Cross Correlation’


using the input sequences.

SIGNAL AND SYSTEM 2


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER –IV

Experiment No: - 01
AIM: Write a MATLAB based program for the different types of signal generation.
(1) OBJECTIVE: -
(A) Program for the generation of ‘unit impulse’ signal
(B) ‘Unit step’ sequence [u(n)-u(n-N)],
(C) ‘Ramp’ sequence, and
(D) ‘Exponential’ sequence.
PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window
PROGRAM:-
unit impulse
>> clear all
>> t = -2:1:2;
>> y = [zeros(1,2),ones(1,1),zeros(1,2)];
>> subplot(2,2,1);
>> stem(t,y);
>> ylabel('Amplitude -->');
>> xlabel('(a) n -->');
Unit step
>> clear all
>> n = input('enter the N values'); enter the N values 7
>> t = 0:1:n-1;
>> y1 = ones(1,n);

>> subplot(2,2,2);

SIGNAL AND SYSTEM 3


>> stem(t,y1);

>> ylabel('Amplitude -->');

>> xlabel('(b) n -->');

Ramp

>> clear all

>> n1 = input('enter the length of ramp sequence');

enter the length of ramp sequence 7

>> t = 0:n1;

>> subplot(2,2,3);

>> stem(t,t);

>> ylabel('Amplitude -->');

>> xlabel('(c) n -->');

Exponential

>> clear all

>> n2 = input('enter the length of 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('(d) n -->');

RESULTS:-

Thus the MATLAB program for unit impulse, unit –step, ramp and exponential
sequence was performed and the output was verified.

SIGNAL AND SYSTEM 4


OUTPUT OF EXPERIMENT:-1

SIGNAL AND SYSTEM 5


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER -IV

Experiment No: - 02
AIM: Write a MATLAB based program Program for the generation of ‘sine’ wave and ‘cosine’
wave.

(2) OBJECTIVE: - Program for the generation of ‘sine’ wave and ‘cosine’ wave.

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window
PROGRAM:-

sine

>> clear all

>> t = 0:0.01:pi;

>> y = sin(2*pi*t);z

>> figure(2);

>> subplot(2,1,1);

>> plot(t,y);

>> ylabel('Amplitude -->');

>> xlabel('(a) n -->');

cosine

SIGNAL AND SYSTEM 6


>> clear all

>> t = 0:0.01:pi;

>> y = cos(2*pi*t);

>> subplot(2,1,2);

>> plot(t,y);

>> ylabel('Amplitude -->');

>> xlabel('(b) n -->');

RESULTS:-

Thus the MATLAB program for sine and cosine wave was performed and the
output was verified.

SIGNAL AND SYSTEM 7


OUTPUT OF EXPERIMENT:-2

SIGNAL AND SYSTEM 8


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER -IV

Experiment No: - 03
AIM: Write a MATLAB based program computing the Linear convolution of the input
sequences.

OBJECTIVE: -

Program for linear convolution of the sequence x=[1,2] and h=[1,2,4].

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window

PROGRAM:-

>> clear all;

>> x = input('enter the 1st sequence');

enter the 1st sequence [1 2]

>> h = input('enter the 2nd sequence');

enter the 2nd sequence [1 2 4]

>> y = conv(x,h);

>> figure;

>> subplot(3,1,1);

SIGNAL AND SYSTEM 9


>> stem(x);

>> ylabel('Amplitude -->');

>> xlabel('(a) n-->');

>> subplot(3,1,2);

>> stem(h);

>> ylabel('Amplitude -->');

>> xlabel('(b) n -->');

>> subplot(3,1,3);

>> stem(y);

>> ylabel('Amplitude -->');

>> xlabel('(c) n -->');

>> disp('The resultant signal is');

The resultant signal is

>> y

y=

1 4 8 8

RESULTS:-

Thus the MATLAB program for computing the linear convolution of two sequences
was performed and the output was verified. Figure below shows the discrete input signals
x(n) and h(n) and the convolved output y(n).

SIGNAL AND SYSTEM 10


OUTPUT OF EXPERIMENT:-3

SIGNAL AND SYSTEM 11


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER -IV

Experiment No: - 04
AIM: Write a MATLAB based program computing the Circular convolution of the input
sequences.

(B) OBJECTIVE: - Program for computing ‘Circular Convolution’.

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window
PROGRAM:-

>> clear;

>> a = input('enter the sequence x(n) =');

enter the sequence x(n) = [1 2 4]

>> b = input('enter the sequence h(n) =');

enter the sequence h(n) = [1 2]

>> n1 = length(a);

>> n2 = length(b);

>> N = max(n1,n2);

>> x = [a zeros(1,(N-n1))];

SIGNAL AND SYSTEM 12


>> for i = 1:N

k = i;
for j =1:n2
H(i,j) = x(k)*b(j);
k = k-1;
if(k == 0)
k = N;
end
end
end
>> y = zeros(1,N);
>> M = H';

>> for j = 1:N

for i = 1:n2

y(j) = M(i,j)+y(j);

end

end

>> disp('The output sequence is y(n)=');

The output sequence is y(n)=

>> disp(y);

9 4 8

>> stem(y);

>> title('Circular Convolution');

>> xlabel('n');

>> ylabel('y(n)');

RESULTS:-

Thus the MATLAB program for computing the circular convolution of two
sequences was performed and the output was verified.

SIGNAL AND SYSTEM 13


OUTPUT OF EXPERIMENT:-4

SIGNAL AND SYSTEM 14


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER -IV

Experiment No: - 05
AIM: Write a MATLAB program for Computation and plot of Z-transform.

OBJECTIVE: Analyze the real and imaginary part of z-transform.

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window

PROGRAM:-

>> clear all; close all; clc;

% Input numerator and denominator coefficients

num = input('Enter the numerator polynomial: '); % e.g., [2 3 1]

den = input('Enter the denominator polynomial: '); % e.g., [1 2 0 2 3 4]

% Create transfer function

trans = tf(num, den);

% Compute zeros, poles, and gain

[zeros, poles, gain] = tf2zp(num, den);

SIGNAL AND SYSTEM 15


% Display results

disp('Poles of transfer function are:');

disp(poles);

disp('Zeros of transfer function are:');

disp(zeros);

disp('Gain of transfer function is:');

disp(gain);

% Plot pole-zero diagram

zplane(num, den);

title('Pole-Zero Plot');

xlabel('Real Part');

ylabel('Imaginary Part');

grid on;

RESULTS:-

Thus the MATLAB program for Z-transform (Computation and plot) was
performed and the output was verified.

SIGNAL AND SYSTEM 16


OUTPUT OF EXPERIMENT:-5

SIGNAL AND SYSTEM 17


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER –IV

Experiment No: -06


AIM: Write a MATLAB program for Computation and plot of Inverse Z-transform.

OBJECTIVE: Analyze the real and imaginary part of Inverse z-transform.

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window

PROGRAM:-

clear all;

clc;

close all;

num = input('enter the numerator polynomials=');

den = input('enter the denominator polynomials=');

L = input('enter the number of points to be computed=');

SIGNAL AND SYSTEM 18


[g ,t] = impz (num , den ,L ); % impulse response

disp ([ 'Coefficients of the power series expansion = [ ', num2str(g') '] ']);

% Plot the impulse response

stem(g);

xlabel ('Time index n ');

ylabel ('Amplitude');

title ('Impulse Response');

grid ;

RESULTS:-

Thus the MATLAB program for Inverse Z-transform (Computation and plot) was
performed and the output was verified.

SIGNAL AND SYSTEM 19


OUTPUT OF EXPERIMENT:-6

SIGNAL AND SYSTEM 20


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER –IV

Experiment No: - 07
AIM: Write a MATLAB based program showing the implementation of ‘Auto-Correlation’
using the input sequences.

OBJECTIVE: -

Program for computing ‘autocorrelation’ function.

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window
PROGRAM:-

>> clear all

>> x = input('enter the sequence');

enter the sequence [1 2 3 4]

>> y = xcorr(x,x);

>> figure;

>> subplot(2,1,1);

>> stem(x);

>> ylabel('Amplitude -->');

>> xlabel('(a) n -->');

SIGNAL AND SYSTEM 21


>> subplot(2,1,2);

>> stem(x);

>> stem(fliplr(y));

>> ylabel('Amplitude -->');

>> xlabel('(b) y(n) -->');

>> disp('The resultant signal is');

The resultant signal is

>> fliplr(y)

ans =

4.0000 11.0000 20.0000 30.0000 20.0000 11.0000 4.0000

RESULTS:-

Thus the MATLAB program for computing the autocorrelation function of


sequences was performed and the output was verified.

OUTPUT OF EXPERIMENT:-1
SIGNAL AND SYSTEM 22
OUTPUT OF EXPERIMENT:-7

SIGNAL AND SYSTEM 23


INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT:SIGNAL AND SYSTEM SUBJECT CODE:EC-402

CLASS: EC 2rd Year SEMESTER -IV

Experiment No: - 08
AIM: Write a MATLAB based program showing the implementation of ‘cross Correlation’
using the input sequences.

OBJECTIVE: - Program for computing ‘cross-correlation’ of the sequneces x=[1,2,3,4] and


h=[4,3,2,1].

PROCEDURE:-

● Open MATLAB
● Open new M-file
● Type the program
● Save in current directory
● Compile and Run the program
● For the output see command window\ Figure window

PROGRAM:-

>> clear all;

>> x = input('enter the 1st sequence');

enter the 1st sequence [1 2 3 4]

>> h = input('enter the 2nd sequence');

enter the 2nd sequence [4 3 2 1]

>> y = xcorr(x,h);

SIGNAL AND SYSTEM 24


>> figure;

>> subplot(3,1,1);

>> stem(x);

>> ylabel('Amplitude -->');

>> xlabel('(a) n-->');

>> subplot(3,1,2);

>> stem(h);

>> ylabel('Amplitude -->');

>> xlabel('(b) n-->');

>> subplot(3,1,3);

>> stem(fliplr(y));

>> ylabel('Amplitude -->');

>> xlabel('(c) n-->');

>> disp('The resultant signal is ');

The resultant signal is

>> fliplr(y)

ans =

16.0000 24.0000 25.0000 20.0000 10.0000 4.0000 1.0000

RESULTS:-

Thus the MATLAB program for computing the cross-correlation function of


input sequences was performed and the output was verified.

SIGNAL AND SYSTEM 25


OUTPUT OF EXPERIMENT:-8

SIGNAL AND SYSTEM 26

You might also like