rescaledata

Rescale data using various criteria.

Syntax
y_ = rescaledata(y,mode)
y_ = rescaledata(y,yref,mode)
y_ = rescaledata(...,region)
[y_,scalefactors] = rescaledata(...)
Description

This function rescales the data in the vector y and returns it in y_. The type of rescaling depends on the setting mode and on the presence or absence of a reference data vector yref.

If a second data array is given in yref, the data in y are rescaled in a way depending on the value of mode:

In all cases, positive rescaling is enforced, i.e. the rescaled data is not inverted.

Without a reference data vector, the rescale options (given in mode) are:

scalefactors is an optional output that provides the calculated scale factor.

Examples

Generate a Gaussian signal and a noisy version of it

n = 200;
x = linspace(-1,1,n);
yn = gaussian(x,0,0.5);
y1 = addnoise(yn,20,'n');
plot(x,yn,x,y1)

The noisy signal can be rescaled in various ways to fit the noise-free one:

y2 = rescaledata(yn,y1,'maxabs');
y3 = rescaledata(yn,y1,'lsq');
plot(x,y1,x,y2,x,y3);
legend('input','maxabs','lsq');
See also

basecorr, deriv, rcfilt, datasmooth