How to display a plot going to infinity?

조회 수: 21 (최근 30일)
Natasha Simone
Natasha Simone 2018년 2월 21일
댓글: Zeynab Mousavikhamene 2019년 9월 2일
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
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 9월 2일
Did you find any answer to your question?

댓글을 달려면 로그인하십시오.

답변 (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