Mercurial > hg > smallbox
comparison util/Rice Wavelet Toolbox/SoftTh.m @ 78:f69ae88b8be5
added Rice Wavelet Toolbox with my modification, so it can be compiled on newer systems.
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Fri, 25 Mar 2011 15:27:33 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
76:d052ec5b742f | 78:f69ae88b8be5 |
---|---|
1 function x = SoftTh(y,thld) | |
2 % x = SoftTh(y,thld); | |
3 % | |
4 % SOFTTH soft thresholds the input signal y with the threshold value | |
5 % thld. | |
6 % | |
7 % Input: | |
8 % y : 1D or 2D signal to be thresholded | |
9 % thld : Threshold value | |
10 % | |
11 % Output: | |
12 % x : Soft thresholded output (x = sign(y)(|y|-thld)_+) | |
13 % | |
14 % HERE'S AN EASY WAY TO RUN THE EXAMPLES: | |
15 % Cut-and-paste the example you want to run to a new file | |
16 % called ex.m, for example. Delete out the % at the beginning | |
17 % of each line in ex.m (Can use search-and-replace in your editor | |
18 % to replace it with a space). Type 'ex' in matlab and hit return. | |
19 % | |
20 % | |
21 % Example: | |
22 % y = makesig('Doppler',8); | |
23 % thld = 0.2; | |
24 % x = SoftTh(y,thld) | |
25 % x = 0 0 0 -0.0703 0 0.2001 0.0483 0 | |
26 % | |
27 % See also: HardTh | |
28 % | |
29 % Reference: | |
30 % "De-noising via Soft-Thresholding" Tech. Rept. Statistics, | |
31 % Stanford, 1992. D.L. Donoho. | |
32 % | |
33 | |
34 %File Name: SoftTh.m | |
35 %Last Modification Date: 8/15/95 17:49:48 | |
36 %Current Version: SoftTh.m 2.4 | |
37 %File Creation Date: Mon Mar 7 10:38:45 1994 | |
38 %Author: Haitao Guo <harry@jazz.rice.edu> | |
39 % | |
40 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved. | |
41 %Created by Haitao Guo, Department of ECE, Rice University. | |
42 % | |
43 %This software is distributed and licensed to you on a non-exclusive | |
44 %basis, free-of-charge. Redistribution and use in source and binary forms, | |
45 %with or without modification, are permitted provided that the following | |
46 %conditions are met: | |
47 % | |
48 %1. Redistribution of source code must retain the above copyright notice, | |
49 % this list of conditions and the following disclaimer. | |
50 %2. Redistribution in binary form must reproduce the above copyright notice, | |
51 % this list of conditions and the following disclaimer in the | |
52 % documentation and/or other materials provided with the distribution. | |
53 %3. All advertising materials mentioning features or use of this software | |
54 % must display the following acknowledgment: This product includes | |
55 % software developed by Rice University, Houston, Texas and its contributors. | |
56 %4. Neither the name of the University nor the names of its contributors | |
57 % may be used to endorse or promote products derived from this software | |
58 % without specific prior written permission. | |
59 % | |
60 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS, | |
61 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | |
62 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
63 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY | |
64 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
65 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
66 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
67 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
68 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
69 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE | |
70 %USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
71 % | |
72 %For information on commercial licenses, contact Rice University's Office of | |
73 %Technology Transfer at techtran@rice.edu or (713) 348-6173 | |
74 % | |
75 %Change History: | |
76 % | |
77 | |
78 x = abs(y); | |
79 x = sign(y).*(x >= thld).*(x - thld); |