How can I change the scale of recustructed signal using Wavelet transform

3 views (last 30 days)
Hi mate.
I'm studying Signal Reconstruction and normalization by wavelet transform. I have used Jon Erickson 's Cont and Inv wavelet Code.
I have original signal looks like sin wave. My goal is 'reconstruct original signal with normalization from -1 to 1 amplitude' via wavelet transform.
But trouble occurs when I use this wavelet code, original signal's amplitude range is about -0.9 to 0.9. But reconstructed signal's range is -0.6 to 0.6
Which parameter do I have to adjust if I want to change scales of signal amplitude?
I attached original signal and reconstructed signal figures, and matlab code.
Regards S. Kwon
original signal
reconstructed signal
  4 Comments
Jon Boerner
Jon Boerner on 13 Oct 2014
It looks like the example in the help for the functions has a similar difference in amplitude as what you are seeing. It might be worth posting on the file exchange submission for some clarification on why this might be.
As for only reconstructing a particular periodic signal, I believe you can modify the scales in some way as to get the output for only one frequency.
There is also a Wavelet Toolbox that the Mathworks has which may have better documentation/support for these things, and other analyses you may do in the future. I would take a look at the documentation for that and see if it looks helpful.
jon erickson
jon erickson on 14 Oct 2014
Soonyang: What scales are you using? Are they sufficient to capture the Fourier freuquencies of the signal that you are reconstructing? Note that the input J1 in function contwt controls this. Try setting J1 to be larger than the default and see what happens. You can only reconstruct accurately what you can deconstruct accurately. In the meanwhile, I will review the code for bugs.
Jon/Soonyang: You can change the wavelet coefficients at various scales. For instance, setting the CWT coeffs = 0 for the largest scales (smallest frequencies) acts like a high pass filter.

Sign in to comment.

Answers (1)

jon erickson
jon erickson on 14 Oct 2014
OK - found the problem...or at least one of possibly multiple problems. The issue does indeed have to do with the number of scales used to compute the transform as well as the inverse transform. Take a look at the figures below. Blue is the original, red is the reconstructed signal. The first figures shows the results when 30 scales are used, the second with 31 scales. Dramatic difference, and one additional scale provides a much more sensible result with proper scaling.
Here's what was happening: in the contwt.m by Torrence and Compo, the number of scales was set using fix(...) which can result in 1 fewer scale than optimal. This led to the bad miscaling that you and others have reported. I updated the code to use ceil(...). This ensures the proper minimum number of scales are used for wavelet transform and inverse transform. One scale fewer can lead to bad misscaling.
So that's issue #1, now fixed. I've attached a script (TEST_WAVELET_v2.m) that I used for testing, for completeness. Note that I used MORLET mother wavelet for both transform and reconstruction.
Here's issue #2, which I don't yet understand. Using any other wavelet ('DOG' or 'PAUL') leads to significant reconstruction scaling errors. Have yet to track down the exact reason why, but I believe there are errors in the wave_bases.m file originally coded by Torrence and Compo. The definitions appear to not match those given in Table 1 of their publication: Torrence and Compo Bul. Am Met. Soc. 1998, pp 68. I suggest you write to them to ask for clarification. In the meanwhile, I will post the updated example and revised code to the file exchange.
hope this helps!
<<
>>

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!