Professional Documents
Culture Documents
EXPERIMENT NO. 01
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:
2. Open new file and enter the program and save it.
4. Compile the program and check for any error and debug it.
MATLAB CODING:
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');
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')
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
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)
y = [3 8 14 30 43 56 64 72 77 50 24]
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)
Result: Hence we have generated the basic signals like unit impulse, unit step, unit ramp
signal and Exponential signals using MATLAB.