EXPERIMENT - 4
AIM
To plot Continuous and Discrete Heaviside Unit Step Function in MATLAB.
THEORY
The Heaviside step function, or the unit step function, usually denoted by H , is a discontinuous function whose value is zero for negative argument and one for positive argument.
MATLAB COMMANDS USED
* plot(x,y,color,properties)
* heaviside(t);
* stem(x);
MATLAB CODE
t=-1:0.01:1;
y=heaviside(t);
subplot(2,1,1);
%The Code is for continuous unit step
plot(t,y,'b');
xlabel('time in seconds');
ylabel('y(t)');
title('Plot of continuous heaviside unit
step function from -1 to 1');
%Discrete unit step
n = -20:1:20;
y= heaviside(.05*n);
subplot(2,1,2);
stem(n,y,'b','filled');
xlabel('n i.e. Sample number');
ylabel('y(n)');
title('Plot of discrete heaviside unit
step function from -1 to 1');
print('Unit Step','-dpng')
RESULT
The Continuous and Discrete versions of Unit step or Heavside Function has been plotted.