Code covered by the BSD License  

Highlights from
Smoooth and Differentiate

5.0

5.0 | 1 rating Rate this file 14 Downloads (last 30 days) File Size: 2.17 KB File ID: #34772
image thumbnail

Smoooth and Differentiate

by Carlos J. Dias

 

25 Jan 2012 (Updated 27 Jan 2012)

A function that smoothes and calculates the first derivative of a two column matrix input data.

| Watch this File

File Information
Description

% 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
%

Required Products MATLAB
MATLAB release MATLAB 7.11 (2010b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
26 Jan 2012 Rui

Great tool. Very easy to use. Differentiation capability very usefull. Thanks for sharing.

Please login to add a comment or rating.
Updates
25 Jan 2012

The description of the function was corrected.

25 Jan 2012

The description of the function was corrected.

25 Jan 2012

The description has been corrected.

27 Jan 2012

Improved description of the function

Tag Activity for this File
Tag Applied By Date/Time
mathematics Carlos J. Dias 25 Jan 2012 10:25:40
measurement Carlos J. Dias 25 Jan 2012 10:25:40
signal processing Carlos J. Dias 25 Jan 2012 10:25:40
interpolation Carlos J. Dias 25 Jan 2012 10:25:40

Contact us at files@mathworks.com