I need the algorithm behind polyfit function in Matlab
31 views (last 30 days)
Show older comments
Hi, I need the algorithm behind polyfit function of matlab. I have a 3rd order polynomial curve. I need to find a polynomial best fit for the curve. kindly help me with the algorithm n procedure. Reply me to agsagastheesh@gmail.com. Thank you.
0 Comments
Answers (1)
Walter Roberson
on 26 Jun 2012
Algorithms
The polyfit MATLAB file forms the Vandermonde matrix, V, whose elements are powers of x. v(i,j) = x(i)^(n-j)
It then uses the backslash operator, \, to solve the least squares problem Vp≅y.
You can modify the MATLAB file to use other functions of x as the basis functions.
0 Comments
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!