Isolate the linear segment of data/graph
Mostra commenti meno recenti
I am trying to create a script where I plot data and I need to find the slope of the most linear segment of the data/graph. Any ideas on how I can do that for a script whose data will vary for each trial.

3 Commenti
Are you refering to the vertical line at x=0?
Define "most linear". What segment is most linear in this plot below?
plot(round(sin(-4:.05:4)))
axis padded
Luis Martin Romero
il 30 Ago 2021
Adam Danz
il 30 Ago 2021
I'd compute the slope using gradient as Star Strider recommended. If you plot the results you'll see a relatively straight line at some high value and will be precipitously fall off at the point where the original data starts to call off. To quantitatively determine the endpoint of the 'straight' line, you could take the 2nd derivative (gradient of the gradient) to locate the first spike that crosses a threhold you set.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

