Guide on MATLAB wavelet

Discussion in 'Programmer's Corner' started by chloe, Apr 1, 2007.

  1. chloe

    Thread Starter New Member

    Apr 1, 2007
    2
    0
    Hi all,
    I've just started to do some programming on wavelet using MATLAB. I've noticed that there are alot of ways to write the program. However, I always hit errors when I try to write the programs. In my program, I need to read off an ECG file (.DAT or .DCD) and then perform the wavelet transform and get the baseline wander and noise free signal. I'd implement the similar process using IIR BPF. However, I really hit a dead end with the wavelet method. Any advise or a starter to guide me along?Thanks!

    These are my codes:
    -------------------------------------------------------
    clear all

    load Qon
    load Qoff

    [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(wname);
    subplot(3,1,1); stem(Lo_D);
    title('Decomposition low-pass filter');
    subplot(3,1,2); stem(Hi_D);
    title('Decomposition high-pass filter');
    subplot(3,1,3); stem(Lo_R);
    title('Reconstruction low-pass filter');
    %subplot(3,1,4); stem(Hi_R);
    title('Reconstruction high-pass filter');
    xlabel('The four filters for db5')

    for file_no = 111

    close all;
    filename = sprintf('d_%05d',file_no);
    load(filename)

    figure(1);
    plot(ecg),grid on;hold on;

    end
    -------------------------------------------------------
     
  2. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    What sort of errors are you encoutering? i.e. error messages to the Matlab command line.

    Sadly, I like many here won't have access to the Wavelet Toolbox so we can only give qualitative help based on your source code and details of the error messages you are receiving.

    Dave
     
  3. DrNick

    Active Member

    Dec 13, 2006
    110
    2
    I'd check to see if you have the wavelet toolbox installed properly. I had a bit of trouble installing it. It kept putting stuffin wrong directories, making it troublesome...

    Also where is the variable wname coming from? Is that loaded from the Q* files or what? What basis are you using? I don't see one declared anywhere.
     
  4. chloe

    Thread Starter New Member

    Apr 1, 2007
    2
    0
    Thanks. Well, it doesnt prompt error when I run just the codes for the wavelet:

    ---------------------------------------------------------------
    [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(wname);
    subplot(3,1,1); stem(Lo_D);
    title('Decomposition low-pass filter');
    subplot(3,1,2); stem(Hi_D);
    title('Decomposition high-pass filter');
    subplot(3,1,3); stem(Lo_R);
    title('Reconstruction low-pass filter');
    %subplot(3,1,4); stem(Hi_R);
    title('Reconstruction high-pass filter');
    xlabel('The four filters for db5')
    ---------------------------------------------------------------
    so I suppose that goes well. Since I got this codes from MATLAB help. However, when I tried to implement it with my own ECG datas it just doesnt work out. Cos the output of the ECG data that I've got is just some random noise. I couldn't figure out much cos I'm new to MATLAB and from the literature, I'm suppose to get a clean baseline wander and noise free signal.
     
  5. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Where have you got your ECG data from? If you are adapting the code from the Matlab help, and you are not getting any error messages this indicates that your code is correct(ish) for your application. Have you tried you code on another ECG dataset (preferably one from a different source). You need to ensure the data is appropriately formatted for what you are trying to achieve.

    Dave
     
  6. decloop

    New Member

    May 15, 2008
    4
    0
    Hi,
    My project is entering "Mel" or "Bark" scale in wavelet speech enhancement.
    any one can help me to enter this scale in matlab mfile.
    I use wavread to read wav file.
    then I use DWT function.
    But I don't know how to change frequency scale in FFT function
    or wavelet function (DWT)!!!

    please help me.
     
Loading...