Least square polynomial fit
Show older comments
I have two arrays x(i) ,y(i). I need to do a least square polynomial fitting for y(i). After the polynomial fit is done, I need to find the maximum of y(i), say y(n) and then corresponding to that find the value of x(n). Can you please suggest, how shall I proceed? What are the math functions involved?
Accepted Answer
More Answers (1)
Dr. Seis
on 21 Jan 2012
0 votes
Check out "polyfit", "polyval" and "max"
- polyfit will give you the polynomial coefficients for an n-order polynomial
- polyval will give you new y-values when you supply it new x-values and the polynomial coefficients found in polyfit
- max will give you the max value associated with you new y-values, it can also supply you the index of the max value so you can determine its corresponding value from your new x-values
Categories
Find more on Polynomials 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!