Main Content

mswthresh

Perform multisignal 1-D thresholding

Description

Y= mswthresh(X,sorh,T)返回软或硬T-thresholding of the matrixX.Tcan be a single value, a matrix the same size asX, or a vector. IfTis a vector, thresholding is performed row-wise, andLT = length(T)这是必须的,size(X,1) ≤ LT. Only the firstsize(X,1)values ofTare used.

example

Y= mswthresh(X,sorh,T,'c')performs thresholding column-wise, andLT = length(T)这是必须的,size(X,2) ≤ LT. Only the firstsize(X,2)values ofTare used.

Examples

塌陷e all

Create a 3-by-3 matrix and a 1-by-3 vector of threshold values.

mat = [1 1 3; 1 1 3; 2 2 3]
mat =3×31 1 3 1 1 3 2 2 3
thr = [1 2 3]
thr =1×31 2 3

Apply soft thresholding to the matrix row-wise. Thekth threshold inthris applied to thekth row ofmat.

mswthresh(mat,'s',thr)
ans =3×30 0 2 0 0 1 0 0 0

Apply soft thresholding to the matrix column-wise. Thekth threshold inthris applied to thekth column ofmat.

mswthresh(mat,'s',thr,'c')
ans =3×30 0 0 0 0 0 1 0 0

Apply hard thresholding to the matrix row-wise.

mswthresh(mat,'h',thr)
ans =3×30 0 3 0 0 3 0 0 0

Apply hard thresholding to the matrix column-wise.

mswthresh(mat,'h',thr,'c')
ans =3×30 0 0 0 0 0 2 0 0

Input Arguments

塌陷e all

Input data to threshold, specified as a real-valued matrix.

Data Types:double

Type of thresholding to perform, specified as:

  • 's'— Soft thresholding

  • 'h'— Hard thresholding

Threshold value, specified as a real-valued scalar or vector.

Data Types:double

Output Arguments

塌陷e all

Thresholded data, returned as a real-valued matrix.Yhas the same dimensions asX.

Algorithms

  • Ifsorhis's',Yis the soft thresholding ofX: Y = sign(X) · ( | X | T ) + where

    ( x ) + = { x if x 0 0 otherwise

    Soft thresholding is wavelet shrinkage.

  • Ifsorhis'h',Yis the hard thresholding ofX: Y = X · 1 ( | X | > T ) where

    1 ( | X | > T ) = { 1 if | X | > T 0 otherwise

    Hard thresholding is cruder than soft thresholding.

Version History

Introduced in R2007a