tidal fitting toolbox

The tidal fitting toolbox simplifies the task of fitting tide models to time series. It is split into a tidalfit and a tidalval functions using the the familiar structure of polyfit and polyval.

close all

read in data.

First we load some hourly tide gauge observations from Richard's Bay, South Africa.

Datasource: RQDS



xlim([datenum('1 oct 2010') datenum('1 dec 2010')])
title(sprintf('%s, %s',,data.header.region))

Fit tidal model

Next we fit a tidal model to the entire data back to 1977. The resulting model is a structure which we later can pass to tidalval.

We use default options: OLS on detrended-data, automatic decision on which components to fit.

lsqr converged at iteration 6 to a solution with relative residual 0.26.

Make a tidal prediction

We then use the fitted model structure to predict the tide.

t=(datenum('1 jan 2010'):1/24:datenum('1 dec 2010'))';

%shift mean to match latest observations.
z=z+nanmean(data.d(data.d(:,1)>datenum('1 oct 2010'),2));

hold on