Home > hfrc > matlab > @HFRC > lst_squ_harmonics.m

lst_squ_harmonics

PURPOSE ^

LST_SQU_HARMONICS - Removes harmonics (typically tides) from HFRC objects.

SYNOPSIS ^

function [ h1, h2, AU, TU, AV, TV ] = lst_squ_harmonics( h, f, au, tu, av, tv )

DESCRIPTION ^

 LST_SQU_HARMONICS - Removes harmonics (typically tides) from HFRC objects.

 This functions uses a least squares method to remove tidal (or any
 other frequency component) from current data.  It is suitable for
 removal of tides and comparison of amplitudes and phases between
 different objects, but is not suitable for full tidal analysis and
 prediction.  Use the t_tide method for that.

 It fits the given data to:

 U(t) = sum_i=1_to_n ( AU_i * cos( 2*pi*f_i*t - theta_U_i ) )
 V(t) = sum_i=1_to_n ( AV_i * cos( 2*pi*f_i*t - theta_V_i ) )

 Usage: hfrc_notide = lst_squ_harmonics( hfrc_obj, f )
        hfrc_notide = lst_squ_harmonics( hfrc_obj, f )
        [ hfrc_notide, hfrc_tide ] = lst_squ_harmonics( hfrc_obj, f )
        [ hfrc_notide, hfrc_tide, AUs, theta_Us, AVs, theta_Vs ] = ...
                            lst_squ_harmonics( hfrc_obj, f )
        hfrc_notide = lst_squ_harmonics( hfrc_obj, f, AUs, theta_Us, ...
                                    AVs, theta_Vs )
        [ hfrc_notide, hfrc_tide ] = lst_squ_harmonics( hfrc_obj, f, AUs, ...
                                     theta_Us, AVs, theta_Vs ) 

 where f is an arbitrary length row vector of tidal frequencies in
 cycles/day, hfrc_notide is the detided hfrc object, hfrc_tide is the
 tidal part of the hfrc object, AUs is a [ n x gridPts ] matrix, where n
 is the number of tidal harmonics removed, with the final AU_i's mentioned
 above. Similarly for theta_Us, AVs, theta_Vs.  All angles are returned
 in radians.

 Note that the last two forms allow you to give the A's and theta's,
 assuming they were calculated at some prior time with another time
 series (using the same grid), and have those components removed from
 the data.

 Note that this function will not perform tidal removal for any grid
 points for which less than 1 percent of the data is present, or for
 which there are less than 5 good points.

 NOTE that this function removes the mean from the data before
 performing the detiding (using the HFRC/polyfit function).  The
 resulting detided HFRC object, however, contains this mean.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

     $Id: lst_squ_harmonics.m,v 1.2 2003-04-02 00:56:07 dmk Exp $    

 Copyright (C) 2001 David M. Kaplan
 Licence: GPL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 18-Dec-2006 07:26:46 by m2html © 2003