EXPERIMENT - 7
AIM
To plot Continuous and Discrete Unit Impulse or Dirac Delta Function in MATLAB.
THEORY
In mathematics, the Dirac delta function, or function, is a generalized function, or distribution, on the real number line that is zero everywhere except at zero, with an integral of one over the entire real line. The delta function is sometimes thought of as an infinitely high, infinitely thin spike at the origin, with total area one under the spike.
MATLAB COMMANDS USED
* plot(x,y,color,properties)
* heaviside(t);
* stem(x)
MATLAB CODE
%The Code is for dirac delta function
t=-1:0.01:1;
y=double(t==0);
subplot(2,1,1);
plot(t,y,'b');
xlabel('time in seconds');
ylabel('y(t)');
title('Plot of continuous dirac delta
function from -1 to 1');
%Discrete dirac delta ramp
n = -20:1:20;
y_n= double(n==0);
subplot(2,1,2);
stem(n,y_n,'b','filled');
xlabel('n i.e. Sample number');
ylabel('y(n)');
title('Plot of discrete dirac delta function
from -1 to 1 with 41 samples');
print('Dirac Delta','-dpng')
RESULT
The Continuous and Discrete versions of Unit Impulse Function has been plotted.