Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Roll No.

9023/18
…:::Program 1:::…
Aim: Program to generate Impulse, Unit-Step & Ramp Function.
Software Used: MATLAB 2018a
Input:
Editor

%Program to generate Impulse, Unit-Step & Ramp Functions

%Defining Functions
t=-10:1:10;
impulse = t==0; %Impulse Function
unitstep = t>=0; %Unit Step Function
ramp = t.*unitstep; %Ramp Function

%Plotting Unit Impulse Function


subplot(221);
stem(t,impulse);
title('(1) Unit Impulse Function');
grid on;
xlabel('t');
ylabel('x(t)');

%Plotting Unit Unit Step Function


subplot(222);
stem(t,unitstep);
title('(2) Unit Step Function');
grid on;
xlabel('t');
ylabel('x(t)');

%Plotting Unit Ramp Function


subplot(223);
stem(t,ramp);
title('(3) Ramp Function');
grid on;
xlabel('t');
ylabel('x(t)');
Roll No. 9023/18

Output:

Results:
Impulse, Unit-Step & Ramp Functions have been successfully generated.

You might also like