Code covered by the BSD License  

Highlights from
Wavelet denoising of vaginal pulse amplitude

image thumbnail
from Wavelet denoising of vaginal pulse amplitude by Nicole Prause
Uses an automated wavelet algorithm to remove noise components from the vaginal PA

fxm=smoothmultR(fx,c,m,r)
function fxm=smoothmultR(fx,c,m,r)
%Smooth Function Multiplier--Right side only
%Multiplies a section of a function, fx, by a constant, c, but keeps the function
%smooth and continuous
%fx is multiplited by c at the center of the section, and the multiplier decreases
%quadratically to 1 at the two boundary points
%
% Appropriate citation:
% Prause, N., Williams, K., & Bosworth, K. (2009). Wavelet denoising of
% vaginal pulse amplitude. Psychophysiology, in press.
%
%USAGE:
%           fxm=smoothmult(fx,c,m,r)
%INPUTS:
%           fx: the function in question,                   Array
%           c:  the constant of multiplication,             Scalar
%           m:  the center of the section to be multiplied, Scalar
%           r:  the radius of the section to be multiplied, Scalar
%OUTPUT:
%           fxm:the function multiplied across a section by the
%           multiplication constant
%
%NOTE:  if you have two boundary points, x1 and x2, m and r can be found:
%           m=(x2+x1)/2
%           r=(x2-x1)/2

%find boundaries
x1=m;
x2=m+r;

fxm=fx;
u=1:length(fx);     %dependent dummy variable
Mx=ones(1,length(fx));
Mx(x1:x2)=((1-c)/r.^2).*(u(x1:x2)-m).^2+c;

%works for both vertical and horizontal arrays
[xs,ys]=size(fx);
if ys==1
    Mx=Mx';
end

fxm(x1:x2)=fx(x1:x2).*Mx(x1:x2);

Contact us at files@mathworks.com