Tidal fitting toolbox
* Fitting of tidemodels to e.g. sea level data.
* Predictions of tide based on tide model.
Uses familar syntax from polyfit/polyval: tidalfit/tidalval
% TIDALFIT: Fits a tidal model to data
tidalfit uses the HAMELS (ordinary least squares)
technique to fit tidal components to the detrended data. Additionally it
can also do robust fitting.
Please include an acknowledgement to Aslak Grinsted if you use this code.
USAGE: tidal=tidalfit(data[,parameter,value])
INPUT:
------
data: A two column vector.
\ - first column should be a serial date number (See help datenum)
\ - second column should be the y-values (i.e. sea level)
\ (missing values and nans are OK.)
OPTIONAL PARAMETERS:
--------------------
Components: cell-array of strings with names of the which
\ components should be included in the fit? (ALL is default)
\ Note: The routine will only attempt to fit components
\ that have period<data_timespan/4 and period>dt*2.
FittingMethod: 'OLS' for ordinary least squares or 'ROBUST' for robustfitting.
\ (default=OLS)
RobustFitOptions: cell of options for robustfit. (See help robustfit.)
\ only used if FittingMethod='ROBUST'. (default={})
DetrendData: should the data be detrended prior to fitting? (default=true)
Note: optional parameters can be specified using abbreviations. e.g. RFO for RobustFitOptions.
OUTPUT:
-------
If no output arguments are specified the routine will display the results
visually.
tidal: A struct-array containing the fitted model parameters.
\ .name: name of tidal component (see e.g. http://www.mhl.nsw.gov.au/www/tide_glossary.htmlx)
\ .period:period of tidal component in days
\ .speed: frequency of tidal component in degrees per solar hour
\ .amp: amplitude of fitted component
\ .phase: phase of fitted component
Components that are not included in the fit will have NaN in .amp and .phase.
EXAMPLE:
data=datenum(1971,1,1):datenum(2008,1,1);
data=[data;randn(size(data))]';
tidal=tidalfit(data,'fm','robust');
future=[datenum(2008,1,1):datenum(2009,1,1)'];
plot(future,tidalval(tidal,future));
Zitieren als
Aslak Grinsted (2024). Tidal fitting toolbox (https://www.mathworks.com/matlabcentral/fileexchange/19099-tidal-fitting-toolbox), MATLAB Central File Exchange. Abgerufen .
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- Sciences > Geoscience > Oceanography and Hydrology >
- AI and Statistics > Curve Fitting Toolbox > Linear and Nonlinear Regression >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
html/
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.3 | added example html |
|
|
1.0.0.0 | mathworks didn't update the file correctly last time, so i have to re-upload it again. (It is still the old zip file but description has changed.) |