Marking a specific point on a graph

조회 수: 8 (최근 30일)
The Master of Matlab
The Master of Matlab 2016년 11월 3일
편집: The Master of Matlab 2016년 11월 3일
I want to mark a point on my graph which is 63% from the starting point, but I also want the value of the point to appear on the graph as well, not just a marker.
Is there any way of doing this without manually working out what the value on X and Y should be and then manually entering them in?
  댓글 수: 2
Jan
Jan 2016년 11월 3일
What is "my graph", what is "the startpoint" and how do you determine "63% from the startpoint". What have you tried so far and what exatcly is your question? Do you have the wanted coordinates already and are looking for the text() command to insert a label?
The Master of Matlab
The Master of Matlab 2016년 11월 3일
t1 = linspace (0, 120, 13)
v = [0 3.12 5.11 6.30 7.19 7.77 8.16 8.42 8.59 8.70 8.79 8.84 8.88];
plot(t1,v)
I would like to plot 63% from the start point which is 0 and I want this to appear on the graph not just a marker.

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2016년 11월 3일
x = rand(5,1) ;
y = rand(5,1) ;
plot(x,y,'.r')
strx = num2str(x) ;
stry = num2str(y) ;
str = [strx,'',stry] ;
text(x,y,str) ;
doc text
  댓글 수: 1
The Master of Matlab
The Master of Matlab 2016년 11월 3일
편집: The Master of Matlab 2016년 11월 3일
Doesn't help, but thanks.

댓글을 달려면 로그인하십시오.


Star Strider
Star Strider 2016년 11월 3일
Try this:
t1 = linspace(0, 120, 13);
v = [0 3.12 5.11 6.30 7.19 7.77 8.16 8.42 8.59 8.70 8.79 8.84 8.88];
v63 = 0.63*[max(v)-min(v)]+min(v); % 63% Value
t63 = interp1(v, t1, v63); % Time (‘Time Constant’)
figure(1)
plot(t1,v)
hold on
plot(xlim, v63*[1 1], '-r')
hold off
legend('Data', '63%', 'Location','E')
text(t63, v63, sprintf('v = %6.2f\nt1 = %6.2f',v63, t63), 'VerticalAlignment','top')
  댓글 수: 1
The Master of Matlab
The Master of Matlab 2016년 11월 3일
편집: The Master of Matlab 2016년 11월 3일
Thank you i'll give this a go.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by