how plot X=const

1 回表示 (過去 30 日間)
Maxime
Maxime 2014 年 9 月 17 日
回答済み: José-Luis 2014 年 9 月 17 日
I have a Y vector comprising a set of values (eg Y = (2.5, 34, 65, -12, etc ...) I have another G vector comprising a set of values (eg G = (12.5, 5.789, 4.6102, 21.09, etc ...).
I would like to draw on the same graph the curve defined by the vector Y, and, the vertical lines of equation X = 12.5, X = 5.789, X = 4.6102, X = X 21.09 = ... etc (the values defined by my G vector...
How can I do ?
!!!! Y and G have not the same length
  1 件のコメント
José-Luis
José-Luis 2014 年 9 月 17 日
Please, instead of repeating the same question, provide more details that would help us understand what it is you actually want. An image would be quite suited for that in this case.

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

回答 (1 件)

José-Luis
José-Luis 2014 年 9 月 17 日
x = 1:100;
y = cos(x .* 2 .* pi ./100);
X = rand(1,10) .* 100;
Y = interp1(x,y,X);
plot(x,y,'r-','Marker','*');
hold on
stem(X,Y)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by