CDT
CDT copied to clipboard
sinefit returns a constant way off
The constant offset (termoption 3 or 4) is not correct.
@Iverno The examples in the documentation appear to work perfectly. Can you provide a minimal working example that replicates the problem you're running into?
Hi
I used the option 4
-
4:
% case 4 % f = @(A,t) A(1)*sin((yr + A(2))2pi) + A(3) + A(4)*yr;
ft = [A doy_max C trend] also estimates a linear trend over the entire time series in units of y per year. Again, simultaneously solving for four terms will be much more computationally expensive than solving for two yerms, so you may prefer to estimate the trend on your own with polyfit, then calculate the two-term sine fit on your detrended data.
And I did not understand that the offset A(3) is calculated for the year yr = 0. My data is for 1990 – 2021 and the offset indicates that it was pretty cold when Jesus was born. The A(4) is about +0.03 degree/year. I have to do this in two steps, first to use option 3 to establish a sinus with a offset A(3) more like the mean temperature for the period of data, then eliminate the season variation by subtract the sinus values from observations. Then investigate the trends for the difference.