필터 지우기
필터 지우기

how plot X=const

조회 수: 2 (최근 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 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