plot dirac function in matlab

眉间皱痕 提交于 2019-12-07 13:42:29
x = -10 : 0.1 : 10;
y = double(x == 0);
plot(x, y);

or

stem(x, y);

I personally prefer using dirac and setting Inf to 1 or another amplitude.

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

Of course, the other answer is perfectly valid. This is just personal preference for being explicit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!