Haw can I calculate the difference between two points in a plot?
    13 ビュー (過去 30 日間)
  
       古いコメントを表示
    
    Ahmed Alalawi
 2019 年 10 月 31 日
  
    
    
    
    
    回答済み: KALYAN ACHARJYA
      
      
 2019 年 10 月 31 日
            Hi
I would like to get the code for calculating the difference between point A and B in a plot.
I can identify them by looking at the plot, but since I have big data and the points’ position changes every time,  it would be nice if I can do them more objectively with codes. 
X= time
Y= degrees
I have attached the data and a figure 
Thank you for your help 
0 件のコメント
採用された回答
  Ildeberto de los Santos Ruiz
      
 2019 年 10 月 31 日
        Try this:
---------------------------------------
plot(...)
[x,y] = ginput(2); % clic on each point
dx = diff(x)
dy = diff(y)
---------------------------------------
Enjoy!!!
0 件のコメント
その他の回答 (1 件)
  KALYAN ACHARJYA
      
      
 2019 年 10 月 31 日
        You can do that in number of ways
- If you know the corresponding x values of A and B,let say d1 and d2 them
 
idx1=find(x==d1);
idx2=find(x==d2);
result=y(idx1)-y(idx2)
        2. If not find the diff of y, where maximum two change occurs, might be A and B, then follow last step of  1.
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Data Exploration についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!