Realization of Discrete signals using MATLAB
MATLAB Program to plot Unit Step, Unit Impulse, Exponential, Sine and Sinc functions.
Copy the following program code and paste in your MATLAB or any other similar software's Editor to run the code.
Program Code:
% UNIT INPULSE FUNCTION
n = -5:5;
r = [zeros(1,5),ones(1,1),zeros(1,5)];
subplot(2,3,1);
stem(n,r);
xlabel('time index');
ylabel('amplitude');
title('Unit Impluse Function');
% UNIT STEP FUNCTION
n = -5:5;
r = [zeros(1,5),ones(1,6)];
subplot(2,3,2);
stem(n,r);
xlabel('time index');
ylabel('amplitude');
title('Unit Step Function');
% EXPONENTIAL FUNCTION
n = -5:5;
a = 1;
r = exp(a*n);
subplot(2,3,4)
stem(n,r);
xlabel('time index');
ylabel('amplitude');
title('Exponential Function');
% SINUSOIDAL FUNCTION
n = -5:5;
r = sin(n);
subplot(2,3,5)
stem(n,r);
xlabel('time index');
ylabel('amplitude');
title('Sinusoidal Function');
% SINC FUNCTION
n = -10:10;
r = sinc(n*.2);
subplot(2,3,6)
stem(n,r);
xlabel('time index');
ylabel('amplitude');
title('Sinc Function');
Output:
For any code related queries comment below. Thanks for reading and happy learning!
Oh, by the way, If you like reading tech related articles, visit Modern Technology: Boon or Bane? or if you want to read some 'ambiguous' blogs then visit "Out of the Box" ;) Hope you'll like it.

Comments
Post a Comment