How to get matlab to find a point on a graph where there is a sudden change?
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Joe Smith
 am 5 Mär. 2015
  
    
    
    
    
    Kommentiert: Image Analyst
      
      
 am 5 Mär. 2015
            I have a graph of 'data point number' against 'distance'.
Around data point number 2500 damage is introduced and the graph has a sudden spike.
Is there some way of getting matlab to detect this sudden change?
0 Kommentare
Akzeptierte Antwort
  Michael Haderlein
      
 am 5 Mär. 2015
        You can define a threshold value either for y or for diff(y). Assume you define failure as point when y>0.2:
plot(x,y), hold all
ind=find(y>0.2,1,'first');
plot(x(ind:end),y(ind:end),'rx')
fprintf(1,'Failure at x = %d\n',ind);
If you want to define the threshold on diff(y), do the same but use ind=find(diff(y)>0.2,1,'first'); instead.
2 Kommentare
  Image Analyst
      
      
 am 5 Mär. 2015
				%d means to print the value of ind assuming that ind is an integer. \n adds a line feed (new line) after it's been printed.
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!