Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
wavelet packet decomposition..

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 12 Feb, 2010 18:01:02

Message: 1 of 11

but i need this packet decomposition, which should give us a transformed signal...
its here
http://en.wikipedia.org/wiki/Wavelet_packet_decomposition
as i've seen your earlier comments, you can figure it out.

Subject: wavelet packet decomposition..

From: Wayne King

Date: 12 Feb, 2010 18:18:09

Message: 2 of 11

"mahmud_dbm " <mahmud_dbm@yahoo.com> wrote in message <hl450u$fja$1@fred.mathworks.com>...
> but i need this packet decomposition, which should give us a transformed signal...
> its here
> http://en.wikipedia.org/wiki/Wavelet_packet_decomposition
> as i've seen your earlier comments, you can figure it out.

Hi, I answered you in your other post.

Wayne

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 13 Feb, 2010 04:00:21

Message: 3 of 11

Okay Sir thank you a lot...

suppose i am having a binary sequence, now what i basically want is to decompose this so that i get a transformed signal as it happens here..
http://en.wikipedia.org/wiki/Wavelet_packet_decomposition

then at the receiver side, i will do the opposite to reconstruct the binary sequence back. I'm trying, what happens i'll let you know. ..

but your comments helped a lot, actually i'm new in this wavelet domain, and its a bit tough to visualize signals in this domain than in Time Domain or Frequency Domain.

Subject: wavelet packet decomposition..

From: Wayne King

Date: 13 Feb, 2010 12:50:10

Message: 4 of 11

"mahmud_dbm " <mahmud_dbm@yahoo.com> wrote in message <hl584l$dpa$1@fred.mathworks.com>...
> Okay Sir thank you a lot...
>
> suppose i am having a binary sequence, now what i basically want is to decompose this so that i get a transformed signal as it happens here..
> http://en.wikipedia.org/wiki/Wavelet_packet_decomposition
>
> then at the receiver side, i will do the opposite to reconstruct the binary sequence back. I'm trying, what happens i'll let you know. ..
>
> but your comments helped a lot, actually i'm new in this wavelet domain, and its a bit tough to visualize signals in this domain than in Time Domain or Frequency Domain.

Hi, that figure you keep posting from Wikipedia is exactly what the wavelet packet transform does in MATLAB. The Wikipedia figure is just displaying the WP tree on its side, while MATLAB plots it vertically. That is all.

Wayne

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 14 Feb, 2010 14:28:04

Message: 5 of 11

Really Thank You Sir, at least now i am sure that i am not doing anything wrong.. :))

But Sir My Problem is, very very simple, say i am having a sequence of 100 bits, after decomposing i need to have a sequence of 100 samples, say 'haar' i'm talking about.

how do i get that decomposed "Sequence", not Tree.. i don't need tree.... :((

i got what u said me that wpdec is doing the same thing, okay thats great.. but how to reconstruct the whole sequence ... say 100 coefficient for 100 input bits..

not just a single coefficient for a particular Node.

when i'd written the program for "wavelet packet decomposition" manually, i used 2 get direct decomposed coefficients sequence... say 100 co-effs for 100 input bits..

sir u do one thing for me, take 100 binary bits, decompose it, get 100 coefficients (not Tree Node), then reconstruct the same 100 bits from co-effs, (not from Tree)

 Sorry sir i know i'm disturbing you, but these tree stuffs freaking me out.. .. .. :((

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 14 Feb, 2010 14:53:02

Message: 6 of 11

Sir and one more thing, if i would have used wavedec, which returns the decomposition structure and coefficients, with the low- and high-pass decomposition filters you specify and i'm getting coefficients there and i am able to reconstruct my signal, no problem with that.. so i need to have the same kind of coefficients for packet too, to reconstruct,

or i should ask you the difference between wavedec and wpdec.. i couldn't understand from doc help... :((

Subject: wavelet packet decomposition..

From: Wayne King

Date: 14 Feb, 2010 16:00:20

Message: 7 of 11

"mahmud_dbm " <mahmud_dbm@yahoo.com> wrote in message <hl92oe$at7$1@fred.mathworks.com>...
> Sir and one more thing, if i would have used wavedec, which returns the decomposition structure and coefficients, with the low- and high-pass decomposition filters you specify and i'm getting coefficients there and i am able to reconstruct my signal, no problem with that.. so i need to have the same kind of coefficients for packet too, to reconstruct,
>
> or i should ask you the difference between wavedec and wpdec.. i couldn't understand from doc help... :((

wavedec gives you a wavelet decomposition, where only the lowpass output is subdivided further into low and high pass parts. A wavelet packet decomposition divides both the lowpass and highpass outputs at each resolution level. You can use wprec() to reconstruct your signal For example:

 % Create a wavelet packets tree.
      x = rand(1,512);
      t = wpdec(x,3,'db3');
      t = wpjoin(t,[4;5]);
      
      % Write values.
      sNod = read(t,'sizes',[4,5]);
      cfs4 = zeros(sNod(1,:));
      cfs5 = zeros(sNod(2,:));
      t = write(t,'cfs',4,cfs4,'cfs',5,cfs5);
      % reconstruct signal with two nodes zero-ed out.
      y = wprec(t);

Wayne

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 15 Feb, 2010 06:24:03

Message: 8 of 11

Dear Sir, Thank you once again to be with me,

Sir, what i am planning to do is, i will have these 512 binary Bits at Transmitter and will pass them through any channel, at the Receiver i will reconstruct them.. this is all i'm planning to do.

from Tx output.. i cant send This "Tree" over any channel, so i need to have the total coefficients of all the nodes of final level decomposition.
(like we get a single coeff sequence using wavedec)

> % Create a wavelet packets tree.
> x = rand(1,512);
> t = wpdec(x,3,'db3');
> t = wpjoin(t,[4;5]); % Still it is a Tree Sir.. :((
       
after decomposing where do i get all the coefficients of last level of decomposition, so that i can send them over any channel. I cant send any tree over any channel, say Awgn..

so i did something like this..

clear all;close all;clc
EbN0=1:10;

for i=1:length(EbN0)
          ip = randint(1,128);
          mbit=pskmod(ip,2);
          T = wpdec(mbit,3,'db3');
          T = wpjoin(T,[4;5]);
          
          noise_bit=awgn(T,EbN0(i));

 % This is an Error, because I Cant Pass This Tree here, i need to pass decomposed Hi & Low pass co-efficients only, and if wprec(T) requires a Tree to get the binary signal back then at the receiver end i need to reconstruct this Tree from Coefficients. not from the Tree we got from the Transmitter side itself, because we "couldn't transmit Tree through the channel"

          % Write values.
          sNod = read(T,'sizes',[4;5]);
          cfs4 = zeros(sNod(1,:));
          cfs5 = zeros(sNod(2,:));
          T = write(T,'cfs',4,cfs4,'cfs',5,cfs5);
          % reconstruct signal with two nodes zero-ed out.
          y = wprec(T);
          op=pskdemod(y,2);
          
          [num ber(i)]=biterr(ip,op);
end

semilogy(EbN0, ber);
grid on;

I Guess i'm in Trouble, but using wavedec i could get the coefficients pretty easily like

                    ip = randint(1,128);
                    mbit=pskmod(ip,2); % Modulation

                    [wbit,l] = wavedec(mbit,2,'haar');
% Low pass Decomposition, and This wbit is Total Coefficients and we are allowed % to pass it through any channel. like

                    nbit=awgn(wbit,EbN0(i)); % Noise addition
                    rbit = waverec(nbit,l,'haar'); % Reconstruction using Coeff

% No Problem here..
Sir i tried to explain my problem my level best, Thank you.. to read this history..
now i hope you can solve it, as i know the problem and u know the solution to it.

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 15 Feb, 2010 17:20:04

Message: 9 of 11

Dear Sir,

Can i use something like this, here i am getting the exact result, but i'm not sure if it is doing the same as i wanted..

          ip = randint(1,512);
          mbit=pskmod(ip,2);
          T = wpdec(mbit,2,'haar');

          % all the coeffs
          cfs = read(T,'allcfs');
          
          % cfs to tree
          T2 = cfs2wpt('haar',N,tnodes(T),2,cfs);
          rbit=wprec(T2);
          dmod=pskdemod(rbit,2);

It is working fine, cudn't understand properly everything,
really thank you sir to be with me ..

Subject: wavelet packet decomposition..

From: Wayne King

Date: 15 Feb, 2010 19:07:03

Message: 10 of 11

"mahmud_dbm " <mahmud_dbm@yahoo.com> wrote in message <hlbvo4$o9h$1@fred.mathworks.com>...
> Dear Sir,
>
> Can i use something like this, here i am getting the exact result, but i'm not sure if it is doing the same as i wanted..
>
> ip = randint(1,512);
> mbit=pskmod(ip,2);
> T = wpdec(mbit,2,'haar');
>
> % all the coeffs
> cfs = read(T,'allcfs');
>
> % cfs to tree
> T2 = cfs2wpt('haar',N,tnodes(T),2,cfs);
> rbit=wprec(T2);
> dmod=pskdemod(rbit,2);
>
> It is working fine, cudn't understand properly everything,
> really thank you sir to be with me ..


Hi, yes, I told you several times, you have to use wprec() to reconstruct the signal from the WP transform.
Wayne

Subject: wavelet packet decomposition..

From: mahmud_dbm

Date: 20 Feb, 2010 01:43:03

Message: 11 of 11

Dear Sir,
Back with Questions again, i was trying some random analysis and got something now,
Now the problem is i'm not getting what i did.. it is here..

T = wpdec(x,2,'haar');
cfs = read(T,'allcfs');

this was about our packet decomposition and we got all the coefficients fine, now the same thing i.e upsampling then passing through HPFs and LPFs would do one level IDWT, so i used that here and i made the tree structure using loops,

        for j=1:log2(N)
            for i=1:N/2^j
                y(i,:)=idwt(x(2*i-1,:),x(2*i,:),'haar');
            end
            x=y;clear y;
        end
say N=64;

Both the cases i should get the same performance.. Yes BER is same in both the cases, but other features like signal peak value, deviations are different. :((

Now my Question is, Internally are they doing the same Job..? from my Tree Structure and Transformation point of view.. or how'd you say this, because i hope i made idwt to work exactly the same as wpdec using that loop.


thank you sir..

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us