* * * 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.
s = trend(A)
s = trend(A,Fs)
s = trend(A,t)
s = trend(...,dim)
s = trend(A,,dim)
[s,int] = trend(...)
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.
Chad Greene (2022). trend (https://www.mathworks.com/matlabcentral/fileexchange/46363-trend), MATLAB Central File Exchange. 取得済み .
プラットフォームの互換性Windows macOS Linux
- Sciences > Earth, Ocean, and Atmospheric Sciences > Glaciology >
- MATLAB > Data Import and Analysis > Data Import and Export > Standard File Formats > HDF5 >
- MATLAB > Data Import and Analysis > Data Import and Export > Standard File Formats > NetCDF >
- Sciences > Earth, Ocean, and Atmospheric Sciences > Climate Science and Analysis >
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!