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

diff

PURPOSE ^

DIFF - This function tries to differentiate the variables in

SYNOPSIS ^

function [dd,num] = diff( h, hvar, dvar, varargin )

DESCRIPTION ^

 DIFF - This function tries to differentiate the variables in
 the HFRC object.

 Usage: deriv = diff( hfrc_obj, hfrc_var_name, 't' )
        deriv = diff( hfrc_obj, hfrc_var_name, 'x' or 'y', 'griddata', ...)
        deriv = diff( hfrc_obj, hfrc_var_name, 'x' or 'y', dim )
        [deriv,num] = diff( ... )

 hfrc_var_name specifies the name of the variable you wish to
 differentiate.  It should be something like 'U', 'V', 'NumRadials{1}',
 'covariance', 'gridflag', 'U_error' or 'V_error'.

 The third argument specifies the dimension along which the differentiation
 will take place.

 If the fourth argument is 'griddata' (the default), then HFRC/griddata is
 used to approximate the function at nearby points and these values are
 used to calculate the derivative.

 If the fourth argument is of class "double", then data is assumed to be on
 a regular NS/EW grid , and dim should be a two element vector with the
 dimensions of the grid (as produced by meshgrid).

 Derivatives are calculated using central differences so that the result
 has the same number of elements as the original.  If one side produces
 an NaN, then the other side will be used alone.  

 ... represents extra arguments to be passed directly to HFRC/griddata.

 The results are always returned with appropriate units: (..)/kms or
 (..)/day, depending on the variable being differentiated by.  Note that
 this means that if U & V have units of cm/s, then the result of dU/dx 
 will have units cm/s/km.  No attempt is made to put the variable in
 more obvious units.

 If a second output argument is requested, then this argument will
 contain a matrix the size of the derivative with the number of good
 derivatives used - for example, if both sides of the derivative were
 good at a point and time, then the result will be 2;  if one side was
 good and the other was bad (NaN), then the result will be 1 ...

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

     $Id: diff.m,v 1.12 2003-06-14 03:07:59 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