matlab中dirac函数的绘制

matlab中dirac函数的绘制,matlab,plot,visualization,Matlab,Plot,Visualization,我试图在Matlab中使用plot绘制Dirac delta函数,但在图中看不到任何内容。我如何想象它 x = -10 : 0.1 : 10; y = double(x == 0); plot(x, y); 或 或 我个人更喜欢使用dirac并将Inf设置为1或其他振幅 x = -1:0.1:1; y = dirac(x); idx = y == Inf; % find Inf y(idx) = 1; % set Inf to some amplitude stem(x,y) 当然,

我试图在Matlab中使用
plot
绘制Dirac delta函数,但在图中看不到任何内容。我如何想象它

x = -10 : 0.1 : 10;
y = double(x == 0);
plot(x, y);


我个人更喜欢使用
dirac
并将
Inf
设置为
1
或其他振幅

x = -1:0.1:1;
y = dirac(x);
idx = y == Inf; % find Inf
y(idx) = 1;     % set Inf to some amplitude
stem(x,y)

当然,另一个答案完全正确。这只是个人对明确的偏好。

我个人更喜欢使用
dirac
并将
Inf
设置为
1
或其他振幅

x = -1:0.1:1;
y = dirac(x);
idx = y == Inf; % find Inf
y(idx) = 1;     % set Inf to some amplitude
stem(x,y)

当然,另一个答案完全正确。这只是个人对显式的偏好。

离散三角函数还是对连续(无限高和单位积分)直接三角函数的近似?如果是,哪种近似值?你能展示一下你目前在做什么吗?这将提供更多的上下文。离散三角函数还是连续(无限高和单位积分)直接三角函数的近似值?如果是,哪种近似值?你能展示一下你目前在做什么吗?这将提供更多的背景。