How to generate a vector of a shifted impulse function?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
FW
am 27 Jul. 2020
Kommentiert: Star Strider
am 27 Jul. 2020
Hello, Suppose we have a time vector x=0:0.1: 50. I would like to have a delta function at a non-zero position, say at 25 with unit height (or any other scaled version of it).
MATLAB has a function d = dirac(x)
It generates dirac at x=0. If we write, d=dirac(x-25), it does not shift the impulse function like the H=heaviside(t-25) translates the heaviside function at 25.
I tried differentiating the translated heaviside function but I get 0.5 0.5 at the desired location instead of 1 at 25, no matter what the sampling frequency is.
Is there are a better way to do
(a) Generate a vector unit delta at a non-zero position
(b) Differentiate translated Heaviside and get a shifted delta at the desired position.
Thanks.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 27 Jul. 2020
‘If we write, d=dirac(x-25), it does not shift the impulse function like the H=heaviside(t-25) translates the heaviside function at 25.’
It does, actually.
Consider:
x = 0:0.1:50;
d = dirac(x - 25);
nzdidx = find(d>0) % Index
dnzd = d(nzdidx) % Value
producing:
nzdidx =
251
dnzd =
Inf
So it will not appear on the plot, since it has infinite amplitude and 0 width, integrating to an area of 1.
.
6 Kommentare
Star Strider
am 27 Jul. 2020
As always, my pleasure!
As for upgrading to R2020a, see the Release Notes to see if it would be of any benefit to you. (Note that Update 4 is current.)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Floating-Point to Fixed-Point Conversion finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!