SoftTh.m
上传用户:speoil
上传日期:2022-06-23
资源大小:224k
文件大小:3k
源码类别:

波变换

开发平台:

Matlab

  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. %File Name: SoftTh.m
  34. %Last Modification Date: 8/15/95 17:49:48
  35. %Current Version: SoftTh.m 2.4
  36. %File Creation Date: Mon Mar  7 10:38:45 1994
  37. %Author: Haitao Guo  <harry@jazz.rice.edu>
  38. %
  39. %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
  40. %Created by Haitao Guo, Department of ECE, Rice University. 
  41. %
  42. %This software is distributed and licensed to you on a non-exclusive 
  43. %basis, free-of-charge. Redistribution and use in source and binary forms, 
  44. %with or without modification, are permitted provided that the following 
  45. %conditions are met:
  46. %
  47. %1. Redistribution of source code must retain the above copyright notice, 
  48. %   this list of conditions and the following disclaimer.
  49. %2. Redistribution in binary form must reproduce the above copyright notice, 
  50. %   this list of conditions and the following disclaimer in the 
  51. %   documentation and/or other materials provided with the distribution.
  52. %3. All advertising materials mentioning features or use of this software 
  53. %   must display the following acknowledgment: This product includes 
  54. %   software developed by Rice University, Houston, Texas and its contributors.
  55. %4. Neither the name of the University nor the names of its contributors 
  56. %   may be used to endorse or promote products derived from this software 
  57. %   without specific prior written permission.
  58. %
  59. %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS, 
  60. %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
  61. %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
  62. %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY 
  63. %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
  64. %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
  65. %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
  66. %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  67. %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
  68. %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE 
  69. %USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  70. %
  71. %For information on commercial licenses, contact Rice University's Office of 
  72. %Technology Transfer at techtran@rice.edu or (713) 348-6173
  73. %
  74. %Change History:
  75. %
  76. x = abs(y);
  77. x = sign(y).*(x >= thld).*(x - thld);