MATLAB Answers

How to plot delta dirac and unit step functions

48 views (last 30 days)
Steven Artzer
Steven Artzer on 22 Sep 2020
Hey all, I am having trouble trying to plot (via stem) some delta dirac and unit step functions for my Digital Signal Processing class!
The ones in particular I am trying to plot are as follows:
Thanks!

  9 Comments

Show 6 older comments
Walter Roberson
Walter Roberson on 23 Sep 2020
DIRAC = @whatever_dirac_delta_function_you_find;
UNITSTEP = @whatever_unit_step_function_you_find;
t = linspace(-50, 50, 500);
Example3 = UNITSTEP(3-T);
stem(t, Example3);
That shows you the syntax . Now you have to find or write a function that implements dirac delta, and find or write a function that implements unit step function.
Steven Artzer
Steven Artzer on 24 Sep 2020
Okay then I guess I'm mostly trying to figure out how to plot the functions listed... Like how exactly I find or write a function in Matlab for those.
Walter Roberson
Walter Roberson on 24 Sep 2020
I already showed you how to plot the functions. What I posted above was actual code.
Further example of plotting.
t = 1 : 10;
y = randi([0 1], 1, 10);
stem(t, y);
I think you should concentrate on writing functions that implement dirac delta and unit step.

Sign in to comment.

Answers (1)

Kiran Felix Robert
Kiran Felix Robert on 4 Nov 2020
Hi Steven,
The Examples shown above can be used to plot the functions using stem.
Refer the documentation of Dirac-delta(Dirac)and unit-step(heaviside) they point to the MATLAB Built-in functions for the unit-step and Dirac-Delta Functions. You can use these Built-in functions to write your required expression and plot using stem.
Kiran Felix Robert

  0 Comments

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!