필터 지우기
필터 지우기

plot vector where negative data is circled

조회 수: 2 (최근 30일)
Toke Søltoft
Toke Søltoft 2015년 3월 13일
답변: Toke Søltoft 2015년 3월 13일
If I e.g. have the following two vectors:
data = [1 2 3 -4 -5 6 -7 8 9 -10]
pos = [1 2 3 4 5 6 7 8 9 10]
How can I do
plot(abs(data),pos)
set(gca,'xscale','log');
where only the negative data is circled? Is that even possible without stepping through each data point?

채택된 답변

Rick Rosson
Rick Rosson 2015년 3월 13일
편집: Rick Rosson 2015년 3월 13일
isNeg = (data < 0);
plot(abs(data),pos)
hold on
plot(abs(data(isNeg)),pos(isNeg),'o')
set(gca,'xscale','log');

추가 답변 (1개)

Toke Søltoft
Toke Søltoft 2015년 3월 13일
thanks so much. Works like a charm.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by