
How to display a plot going to infinity?
17 ビュー (過去 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 件のコメント
回答 (1 件)
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 件のコメント
Walter Roberson
2019 年 1 月 25 日
There are a couple of File Exchange contributions for creating plots with broken axes.
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!