Filter löschen
Filter löschen

How to write delta in matlab?

47 Ansichten (letzte 30 Tage)
SZ N
SZ N am 16 Okt. 2020
Beantwortet: Walter Roberson am 24 Okt. 2023
x2[n]= 2delta[n] - u[n - 1] + u[n - 3]
How to I type this in matlab? Like what is the syntax for delta in matlab?
  3 Kommentare
SZ N
SZ N am 16 Okt. 2020
Like in this question. How do i tyoe it in matlab? It is givig me an error while typing delta.
The error:
Ragab
Ragab am 24 Okt. 2023
\delta(t)

Melden Sie sich an, um zu kommentieren.

Antworten (2)

madhan ravi
madhan ravi am 16 Okt. 2020

Walter Roberson
Walter Roberson am 24 Okt. 2023
Like what is the syntax for delta in matlab?
MATLAB does not have the delta operator. The suggested dirac() does not work for this purpose:
n = [-1 0 1]
n = 1×3
-1 0 1
dirac(n)
ans = 1×3
0 Inf 0
dirac(sym(n))
ans = 
but your delta function should be 1 at parameter 0.
You need to define it yourself, such as
delta = @(x) double(x==0);
delta(n)
ans = 1×3
0 1 0

Kategorien

Mehr zu Time Series Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by