HVPM College of Engineering & Technology, Amravati
Computer Science & Engineering
Digital Signal Processing Practical
Prof. Akhil M. Jaiswal
PRACTICAL NO. 2
Aim: Write a Program in MATLAB for generation of basic signals.
Software Required: MATLAB ver. 7.10.0
Program:-
clc
clear all;
close all;
%Program for Generation of Impulse Signal
disp('Unit Impulse Signal:');
n=input('Enter No. of Samples: ');
t=-n:1:n;
y=[zeros(1,n),ones(1,1),zeros(1,n)];
subplot(2,2,1);
stem(t,y);
ylabel('Amplitude');
xlabel('Samples(n)');
title('Unit Impulse Signal');
%Program for Generation of Unit step Signal
disp('Unit Step Signal:')
n=input('Enter the number of Samples: ');
t=0:1:n-1;
y1=ones(1,n);
subplot(2,2,2);
stem(t,y1);
ylabel('Amplitude');
xlabel('Samples(n)');
title('Unit Step Signal');
%Program for Generation of Ramp Signal
disp('Unit Ramp Signal:')
n1=input('Enter Length of Ramp Sequence: ');
t=0:n1;
subplot(2,2,3);
stem(t,t);
ylabel('Amplitude');
xlabel('Samples(n)');
title('Unit Ramp Signal');
%Program for Generation of Exponential Signal
disp('Exponential Signal:')
n2=input('Enter the length of Exponential Signal: ');
t=0:n2;
a=1;
y2=exp(a*t);
subplot(2,2,4);
stem(t,y2);
ylabel('Amplitude');
xlabel('Samples(n)');
title('Exponential Signal');
Output:- Paste output Screen Window with Name & Roll number into it.
Result:- Thus we have generated various standard signals in MATLAB.