Help with linear fit
Mostrar comentarios más antiguos
Given a curve (x vs y) I need to do a linear fit but only between two points x1 and x2 of that curve. Then, I need to calculate the slope of this line. Could you suggest me the fastest way to do that? Thanks.
Respuesta aceptada
Más respuestas (1)
Jos (10584)
el 7 de Feb. de 2014
Here's how:
tf = x > x1 & x < x2 % true for x1 < x < x2
p = polyfit(x(tf), y(tf),1) % fit on selection
1 comentario
aurc89
el 7 de Feb. de 2014
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!