필터 지우기
필터 지우기

How to plot a series of numbers which some of them are inf?

조회 수: 21 (최근 30일)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 8월 19일
댓글: Walter Roberson 2019년 9월 2일
I have a series of X and Y that some of Ys might be inf. Ys are changing in each loop there might be inf in them (more than one or none).
When I plot with plot(X,Y) function, it deos not show inf values. Any suggestion?
  댓글 수: 4
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 9월 2일
What do you mean by "Bump ^^"?
for example at x=1, y=inf and all other x and y are nonzero. I want at x=1 to add an inf point in the figure like this:Capture.JPG
Adam Danz
Adam Danz 2019년 9월 2일
"Bump" was merely pointing to the question I asked above.

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 8월 19일
plot(X, min(Y, ValueYouWantPlottedInsteadOfInf))
  댓글 수: 11
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 9월 2일
would you please explain more?
Walter Roberson
Walter Roberson 2019년 9월 2일
Adam posted
y = randi(1e10, 1,100);
y(randi(100,1,15)) = inf;
plot(min(y, 2e10), 'o')
set(gca,'ytick',0:2e+09:2e10)
ytickLabels = get(gca,'YTickLabel');
ytickLabels{end} = 'inf x10^{10}';
set(gca, 'YTickLabel', ytickLabels)
His line
ytickLabels = get(gca,'YTickLabel');
creates a variable named ytickLabels. His line
ytickLabels{end} = 'inf x10^{10}';
then changes the last label to that particular string.
Then the line
set(gca, 'YTickLabel', ytickLabels)
tells MATLAB to change the YTickLabel property of the axes to the value stored in the variable ytickLabels
Adam's code does not attempt to use ytickLabels as a function. His code cannot generate the error message you indicate,
Cannot find an exact (case-sensitive) match for 'ytickLabels'
Please post a copy of the code you are using that generates that error message.

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

카테고리

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