[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WaveLab error & fix!

From: Robert Leach
Subject: WaveLab error & fix!
Date: Thu, 14 Aug 2003 16:59:16 -0600

I'm trying to do a daubechies wavelet transform. This is my first attempt at using the WaveLab802 package (and for that matter doing a wavelet analysis), but I suspect (and correct me if I'm wrong) that this problem had to do with compatibility between octave and this MATLAB package:

octave:4> FWT_PO(signal,4,qmf)
error: octave_base_value::list_value(): wrong type argument `matrix'
error: evaluating assignment expression near line 31, column 8
error: called from `aconv' in file `/sw/share/octave/2.1.46/m/WaveLab802/Orthogonal/aconv.m'
error: evaluating assignment expression near line 14, column 3
error: called from `DownDyadLo' in file `/sw/share/octave/2.1.46/m/WaveLab802/Orthogonal/DownDyadLo.m'
error: evaluating assignment expression near line 26, column 13
error: evaluating for command near line 23, column 3
error: called from `FWT_PO' in file `/sw/share/octave/2.1.46/m/WaveLab802/Orthogonal/FWT_PO.m'

Here's the relevant lines in aconv:

        function y = aconv(f,x)
                fflip = reverse(f);

in DownDyadLo:

        function d = DownDyadLo(x,qmf)
                d = aconv(qmf,x);

and in FWT_PO:

        function wcoef = FWT_PO(x,L,qmf)
                beta = ShapeAsRow(x);  %take samples at finest scale as 
                for j=J-1:-1:L
                        alfa = DownDyadHi(beta,qmf);
                        wcoef(dyad(j)) = alfa;
                        beta = DownDyadLo(beta,qmf);

signal is a 1D matrix (1 row & many columns) and qmf is the return from MakeONFilter in the WaveLab package.

Now, I'm not a good octave coder. I can count the number of functions I've written on my digits. I don't know how to utilize all the efficient methods when dealing with arrays and stuff, but I coded up a solution to this problem that *appears* to have fixed it. I could be wrong because I don't know what the correct behavior of the output of FWT_PO is supposed to be (and likewise the MATLAB handling of various data structures in the call to reverse), so please let me know if I've done something wrong. I wrote a new reverse function called MATreverse (for MATLAB reverse). if I were really ambitious, I would write a little datatype check in octave's reverse and call MATreverse if the type is a matrix, but for expediency, I simply changed the call in FWT_PO. Here's the function:

function y = aconv(x)

%I'm writing this because MATLAB's reverse isn't compatible with octave's

s1 = size(x,1); %I'm assuming here that MATLAB will reverse any 1D matrix
s2 = size(x,2);
if s1 == 1,
  if s2 == 1,
    s = s1;
    s = s2;
  s = s1;

for i=1:s
  y(i) = x(s-i+1);

if s == s2
  y = y';

After incorporating this code, FWT_PO runs without error and my gut is telling me from the look of the output that it's right. If you confirm that this is a good thing or improve it (as I'm sure most of you could), where should this be reported?


= Robert W. Leach                                                   =
= Los Alamos National Lab                                           =
= Bioscience Division: Bioinformatics & Computational Biology Group =
= MS M888                                                           =
= Los Alamos, NM 87545                                              =
= address@hidden                                                 =
= 505-667-2307                                                      =
Work Calendar & To-Do List:

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]