Soft or hard thresholding
Y = wthresh(X,SORH,T)
Y = wthresh(X,'s',T)
Y = wthresh(X,'h',T)
Y = wthresh(X,SORH,T) returns the soft (if SORH = 's') or hard (if SORH = 'h') thresholding of the input vector or matrix X. T is the threshold value.
Y = wthresh(X,'s',T) returns , soft thresholding is wavelet shrinkage ( (x)+ = 0 if x < 0; (x)+ = x, if x ≥ 0 ).
Y = wthresh(X,'h',T) returns , hard thresholding is cruder.
% Generate signal and set threshold. y = linspace(-1,1,100); thr = 0.4; % Perform hard thresholding. ythard = wthresh(y,'h',thr); % Perform soft thresholding. ytsoft = wthresh(y,'s',thr); % Using some plotting commands, % the following figure is generated.