How to write delta in matlab?

47 次查看(过去 30 天)
SZ N
SZ N 2020-10-16
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?

回答(2 个)

madhan ravi
madhan ravi 2020-10-16

Walter Roberson
Walter Roberson 2023-10-24
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

类别

Help CenterFile Exchange 中查找有关 Time Series Objects 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by