Help using data from a trend line in my code.
4 次查看(过去 30 天)
显示 更早的评论
Is there a way to incorporate the data from a trend line into your Matlab code without typing it manually? I'm running a system that uses a linear fit trend line from a graph, but the trend line has to be able to change. Currently, every time it changes I'm using the Basic Fitting tool to apply a linear fit, and then copying the equation of the line into my code. This process isn't very efficient though. Is there a way to get and use the linear fit equation just using the code, without going to the graph and applying a trend line every time it changes?
0 个评论
回答(2 个)
Daniel Agin
2014-1-21
1 个评论
Paul
2014-1-21
f is not the function but the function values at the specified x points. the values of p describe the function since they are the polynomial parameter values. A linear polynomial consists of two parameters, the slope value and the offset. p(1) is the slope and p(2) is the offset. So your equation is
f(x) = p(1)*x + p(2)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!