Clear Filters
Clear Filters

Least square fit in Hovmöller

2 views (last 30 days)
Luis Jesús Olvera Lazcano
Answered: sai charan sampara on 10 Oct 2023
How would you do a least square fit onto hovmoller data, i.e. longitude x time. Specifically, considering only negative data
This is to measure the speed of the propagation (in variables like OLR, SST)

Answers (1)

sai charan sampara
sai charan sampara on 10 Oct 2023
Hello Luis,
I understand that you are trying to do least square fit onto Hovmöller Data.
For doing least square fit onto data MATLAB has the function “lsqcurvefit” which does least square fitting of x and y data onto a model function that is provided as part of input. To use “lsqcurvefit” function onto Hovmöller data first identify a mathematical function (linear, exponential or any other) that can roughly describe the behaviour of the data. Create a function handle of the function with x data and coefficients/constants of this function as the parameters. Then call the “lsqcurvefit” function with the correct inputs to get the coefficients as output.
Other functions like “fitlm”, “polyfit” can also be helpful for doing regression.
In Hovmöller data the variables include longitude, time, and the measured variable. For using regression or least square fit it is essential to first change the data into numerical format. For time values the “datetime” format can be used or other normalizations (assigning numerical value to each data point) can be done to make the data numerical. Similarly, longitude data can also be converted into numerical values. These two variables together can form the x data. For using only the negative data, logical indexing can be used on the data set to choose only the specific values.
You can refer to the below MATLAB documentations for more information:
Hope this helps.
Thanks,
Charan.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!