Smoooth and Differentiate
% function ynew=smoothdiff(dados,xnew,sdx,q,nmin)
%
% This function smoothes and differentiates a sequence of numbers based on
% an algorithm similar to Savistky and Golay. There are no restrictions
% however, on the number of points or on their spacing.
% This function also calculates the first derivative at the xnew points
%
% INPUT:
% dados - data in a two column matrix (first column x; second column y)
% xnew - is a vector where new ordinates are to be computed
%
% sdx - is the range of data to be used in the interpolation
% nmin - is the minimum data points to be used in the interpolation.
% q - is the degree of the polynomial to be used in the interpolation
%
% ALGORITHM:
% For each point xi of the xnew vector, this function finds the least
% squares polynomial passing through the experimental points lying between
% [xi-sdx, xi+sdx].
% Using this polynomial it calculates, with polyval, new values for the
% function and its derivative in that same interpolating window.
% All calculated values for each abscissa are used to compute an average
% value of the smoothed function and its derivative.
% When sdx range includes fewer points than nmin, the range is enlarged to
% include at least nmin points. This may occur more often at the edges
% of the data.
% Note that we should have nmin>q
%
% OUTPUT (ynew - 5 column matrix)
% column 1- new abscissas
% column 2- new ordinates
% column 3- their standard error
% column 4- first derivative
% column 5- no. of values that were calculated for the ith point
%
Citar como
Carlos J. Dias (2024). Smoooth and Differentiate (https://www.mathworks.com/matlabcentral/fileexchange/34772-smoooth-and-differentiate), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- MATLAB > Mathematics > Interpolation >
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.