How to display a plot going to infinity?

24 次查看(过去 30 天)
I am meant to plot the Dirac Delta function:
my attempt:
x = -30:1:30;
y = zeros(1,numel(x)); %sets all values initially to zero
y(x==0)= inf; % the point corresponding to x=0 is set to inf
plot(x,y,'d')
axis([-40 40 0 inf])
How can I get it to visually show it going up to infinity?
  2 个评论
Muhammad
Muhammad 2019-1-25
编辑:Muhammad 2019-1-25
Use the tick property in Matlab plot as described below

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2018-2-21
编辑:KSSV 2018-2-21
x = -30:1:30;
y = zeros(1,numel(x)); %sets all values initially to zero
y(x==0)= inf; % the point corresponding to x=0 is set to inf
plot(x,y,'d')
text(-41.,0.65,'~','Fontsize',20)
text(-41.,0.67,'~','Fontsize',20)
text(39,0.65,'~','Fontsize',20)
text(39,0.67,'~','Fontsize',20)
axis([-40 40 0 inf])
Adjust the text positions.....
  2 个评论
Natasha Simone
Natasha Simone 2018-2-21
Sorry I wasn't clear, I am looking to visually display the value of x=0 going to infinity like in this figure:
Walter Roberson
Walter Roberson 2019-1-25
There are a couple of File Exchange contributions for creating plots with broken axes.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by