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

Exp.1 Basic Signals

This document describes experiments conducted in MATLAB to generate basic signals. It includes programs to generate unit impulse, unit step, unit ramp, exponential, cosine, and other signals. Functions like conv and xcorr are used to calculate linear convolution and cross-correlation of sequences. The experiments allow generating and processing basic signals important for understanding communication systems.

Uploaded by

Deepesh Agrawal
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)
55 views

Exp.1 Basic Signals

This document describes experiments conducted in MATLAB to generate basic signals. It includes programs to generate unit impulse, unit step, unit ramp, exponential, cosine, and other signals. Functions like conv and xcorr are used to calculate linear convolution and cross-correlation of sequences. The experiments allow generating and processing basic signals important for understanding communication systems.

Uploaded by

Deepesh Agrawal
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/ 8

Dr.

Shyama Prasad Mukherjee


International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

EXPERIMENT NO. 01

NAME OF THE EXPERIMENT:

To generate basic signals like unit impulse, unit step, unit ramp signal and Exponential
signals using MATLAB.

APPRATUS REQUIRED:

1. Computer

2. MATLAB software

THEORY:
The knowledge of basic signals is very important to understand the functioning of
the modulation and demodulation techniques in communication systems. The
information is carried by the basic signals like pulse, sinusoidal etc., and is processed
by different methods both in analog as well as in digital communications. It is very
necessary to understand and to generate such basic signals in time domain.

PROCEDURE:

1. Open MATLAB software.

2. Open new file and enter the program and save it.

3. Add the path to the location of the file in the system.

4. Compile the program and check for any error and debug it.

5. Note down the output.

MATLAB CODING:

(a). Program for the generation of UNIT impulse signal

clc;
close all;
clear all;
t=-2:1:2;
y=[zeros(1,2),ones(1,1),zeros(1,2)]
stem(t,y);
xlabel('time');
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

ylabel('Amplitude');
title('unit impulse');

(b). Program for the generation of UNIT step signal

clc; close all; clear all;


n=input('enter the n value');
t=0:1:n-1;
y=ones(1,n);
stem(t,y);
xlabel('time');
ylabel('Amplitude');
title('unit step');
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

(c).Program for the generation of unit RAMP signal

clc; close all; clear all;


n=input('enter the n value');
t=0:1:n;
stem(t,t);
xlabel('time');
ylabel('Amplitude');
title('unit ramp');

(d). Program for the generation of Exponential signal

clc; close all; clear all;


n=input('the length of i/p frequency');
t=0:n
a=input('enter the a value');
y=exp(a*t);
stem(t,y);
xlabel(‘Discrete time’);
ylabel('Magnitude');
title('Unit exponential');
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

(e). Program for Discrete time cosine signal:

clc; close all; clear all;


t=0:0.05:6;
y= cos(2*pi*t);
stem(t,y);
xlabel('Discrete time');
ylabel('Amplitude');
title('Cosinusoidal');

(f). Program for Continuous time signal

clc;
close all;
clear all;
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

t=0:0.01:4;
y= cos(2*pi*t);
plot(t,y);
ylabel('Amplitude');
xlabel('Time');
title('Continous Cosine signal')

Program for linear convolution of the sequence

clc;
close all;
x=input('enter the 1st sequence');
h=input('enter the 2nd sequence');
y=conv(x,h);
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(y);ylabel('Amplitude -->');
xlabel('(c) n -->');
disp('The resultant signal is');y
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

enter the 1st sequence [1,2,3,6,5,4]


enter the 2nd sequence [6,5,4,1,2,3]
y = [6 17 32 60 76 83 58 42 32 23 12]

Program for computing cross-correlation of the sequences

clc;
clear all;
close all;
x=input('enter the 1st sequence');
h=input('enter the 2nd sequence');
y=xcorr(x,h);
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');fliplr(y)

enter the 1st sequence[6,5,4,1,2,3]


enter the 2nd sequence[1,2,3,6,5,4]
The resultant signal is
Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

y = [3 8 14 30 43 56 64 72 77 50 24]

Program for computing autocorrelation function

clc;
x=input('enter the sequence');
y=xcorr(x,x);
figure;subplot(2,1,1);
stem(x);ylabel('Amplitude -->');
xlabel('(a) n -->');
subplot(2,1,2);
stem(fliplr(y));ylabel('Amplitude -->');
xlabel('(a) n -->');
disp('The resultant signal is');fliplr(y)

enter the sequence [1,2,3,4]


The resultant signal is

y = [4.0000 11.0000 20.0000 30.0000 20.0000 11.0000 4.0000]


Dr. Shyama Prasad Mukherjee
International Institute of Information Technology
NAYA RAIPUR. Chhattisgarh. 493 661

Result: Hence we have generated the basic signals like unit impulse, unit step, unit ramp
signal and Exponential signals using MATLAB.

You might also like