trend

Fast function for mapping trends along any dimension in 3D data.
2,8K download
Aggiornato 25 mar 2021

Visualizza la licenza

* * * NOTICE * * * A NEW AND IMPROVED VERSION OF THIS FUNCTION CAN BE FOUND IN THE CLIMATE DATA TOOLBOX FOR MATLAB. GET IT HERE: https://www.mathworks.com/matlabcentral/fileexchange/70338

This function returns linear least-squares slopes along any dimension of any N-dimensional data set. The function was designed with large 3D netCDF climate reanalysis data sets in mind, but it will also work data sets of smaller or larger dimensions. This function is much faster and cleaner than the common method of nesting loops, for example, to solve for each lat and lon or each x and y.

An example of how one might use this function is shown in the image at the top of this page. To create this image I used daily surface wind and sea surface temperature fields (ECMWF ERA-Interim) from 1990 through 1999 to solve for trends in SST, zonal wind, and meridional wind. In the 90s, the sea surface cooled around most of Antarctica, but warmed in the Weddell sea, where the meridional component of surface winds strengthened.

SYNTAX:
s = trend(A)
s = trend(A,Fs)
s = trend(A,t)
s = trend(...,dim)
s = trend(A,[],dim)
[s,int] = trend(...)

DESCRIPTION:
s = trend(A) returns the (N-1)-dimensional matrix s corresponding to the linear trend(s) along dimension 1 of A. Assumes data are evenly spaced along dimension 1.

s = trend(A,Fs) declares sampling frequency Fs along trending dimension of A.

s = trend(A,t) allows for unevenly-spaced data in the trending dimension with time vector t. length of t must equal the length of A along its trending dimension.

s = trend(...,dim) returns the trend along dimension dim of A.

s = trend(A,[],dim) assumes data are sampled at 1 Hz or 1/(unit time) or 1/(unit space), etc.

[s,int] = trend(...) also returns the intercepts of the slope-intercept form.

The header of the function contains several usage examples.

Cita come

Chad Greene (2024). trend (https://www.mathworks.com/matlabcentral/fileexchange/46363-trend), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2012b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.1.0.1

text description.

1.1.0.0

Version 2: now supports any ND data sets and returns intercept values -- Thanks Matt J.

1.0.0.0