フィルターのクリア

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 Center および File Exchange2-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