A line at maximum value of y ?

2 ビュー (過去 30 日間)
RS
RS 2013 年 8 月 9 日
want to draw a line at maximum of yth value that will give at what value of x, y is maximum? that value I have to print with legend?
how can I plot perpendicular to this line and want to know value of x, mean at what value of x my y is max coming and i want value of x at which y is maximum and max(y)to be print in legend or somewhere in plot? How can I?

採用された回答

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013 年 8 月 9 日
line(get(gca,'Xlim'), [max(y) max(y)],'color', 'red')
  9 件のコメント
RS
RS 2013 年 8 月 10 日
編集済み: RS 2013 年 8 月 10 日
ok its working; and when I am using subplot command error is something like that
b = subplot(2,1,2); plot(x1,y1(:,1:3)); xlabel('r)'); ylabel('s');
h=b;
limh=get(gca,'Ylim');
chrom=get(h,'color');
line([x1(xmaxA) x1(xmaxA)], [limh(1) max(y1(:,1))], 'color', chrom{1},'Linestyle',':')
Cell contents reference from a non-cell array object.
and after that I want to use combine both plot using
samexaxis('ab','xmt','on','ytac','join','yld',1);
So How can I overcome? At last also I want to put different scale on right y axis and upper x axis? How can I?
Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013 年 8 月 10 日
編集済み: Giorgos Papakonstantinou 2013 年 8 月 10 日
For the sameaxis I have no answer. I don't now what it does and who is the creator of it.
Give a new name to this (not to the subplot h=b):
nameplot=plot(x1,y1(:,1:3));
then
chrom=get(nameplot,'color');
line([x1(xmaxA) x1(xmaxA)], [limh(1) max(y1(:,1))], 'color', chrom,'Linestyle',':'
If you only one plot then (i.e. after the subplot) then chrom is no longer a cell. So the indexing chrom{1} makes no sense. crom in this case is a vector with three elements.
If you want 2 y axis (one on the left and one the right) the use plotyy
And S it's better if you have another question to open another thread. Your first question has been fully covered. If you think that your question has been answered please accept it as answer.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by