# How to threshold wavelet coefficients ( keep largest 1/2 of them )?

Posted 9 years ago
7691 Views
|
3 Replies
|
1 Total Likes
|
 I am using Mathematica 9I got dwd = DiscreteWaveletTransform[data] It returns a DiscreteWaveletData object with coefficients ( I assume ).Now I want to keep only 1/2 largest, to the module , wavelet coefficients from dwd. How to do so? Is there any way to use WaveletThreshold[] to do that?Thank you in advance.
3 Replies
Sort By:
Posted 9 years ago
 I think Bill has provided very useful information to solve your problem. Following his suggestion, to achieve what you asked, WaveletThreshold looks like the function to do the task.However, your question of keeping 1/2 largest is not clear to me at what indices and how to compute the threshold. Do you only want to threshold on all indices or detail ones? Is 1/2 largest meaning over all indices or just detail ones?Once you have computed the threshold with the information Bill has provided, WaveletThreshold allows you to specify which index to perform the thresholding. WaveletThreshold[ dwd, {"Hard", threshold}, indice] For example, this code thresholds all indices: SeedRandom[1];data = RandomReal[{-1, 1}, {8}]; dwd = DiscreteWaveletTransform[data]; Normal@WaveletThreshold[dwd, {"Hard", Median[Abs@Flatten[Last /@ Normal[dwd]]]}, All] returns  {{0} -> {0., 0., -0.979909, 0.}, {1} -> {0.998392, 0.850965, 0., 0.}, {0, 0} -> {0., -0.919499}, {0, 1} -> {0., -0.466301}, {0, 0, 0} -> {-0.716554}, {0, 0, 1} -> {0.583814}} 
Posted 9 years ago
 If you want to peek at all the details really returned by DiscreteWaveletTransform then do this: In[1]:= data = RandomReal[{-1, 1}, {8}]; Normal[DiscreteWaveletTransform[data]] Out[2]= {{0}->{-0.0640216, 0.201553, 0.566641, 0.44696}, {1}->{-0.0263881, -0.110478, -0.650836, -0.449402}, {0, 0}->{0.0972497, 0.716724}, {0, 1}->{-0.18779, 0.0846273}, {0, 0, 0}->{0.575566}, {0, 0, 1}->{-0.438034}} Then on the help page for DiscreteWaveletTransform you can click on Details and Options and guess how to interpret this tree information you are given.This might even help you see how to check to see whether the processing of the results turned out to be correct.
Posted 9 years ago
 Nice, but your answer dosen't seem to be related in any way to my problem. I have checked Details - no insight gained.