Recently I have some data varying with altitude (h) and time (hour). At each time there are two sets of profiles, and 100 hours of data. The two profiles measure the same thing, but they are from different methods and therefore have different values.
I first want to make curving fitting to the first two sets of profiles at each time.
Observing that the vertical variation of data are not linear, then a nonlinear fit can be applied:
x1 (h) = a0 + a1* h + a2* h² + .....
x2 (h) = b0 + b1* h + b2* h² + .....
The question is: how to find the best fit to the profile ? In Python there are functions such as:
parameters = polyfit(x,y,order)
haty = polyval(parameters,x)
I decide to use these functions.
What I did is simple: to build a new function to automatically choose the best fit for each profile by minimizing the root-mean-squre-error between the values and the fits. If the order of the fit is the same for x1 and x2, then it is done. If the order of the fit is not the same for x1 and x2, I compromise to an order that is best for both. These results are then used in the next step study....