Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Replies: 3   Last Post: Oct 28, 2010 5:55 PM

 Messages: [ Previous | Next ]
 Wayne King Posts: 2,961 Registered: 4/1/09
Posted: Oct 28, 2010 5:55 PM

"Dinesh Bhati" <bhatidinesh@gmail.com> wrote in message <ia8cs1\$n7e\$1@fred.mathworks.com>...
> Hi,
>
> Can any one correct the energy Emid. It should also be same as Ex and Ey and equal to one.Note for DB1 you will get the correct Emid.
>
> clear
> clc
> str='db2'
> x=randint(1,10,[1 10]);
> x=x/norm(x(:));
> Ex=sum(x.^2)
> [A,H]=dwt(x,str);
> Emid=sum(A.^2)+sum(H.^2)
> y=idwt(A,H,str);
> Ey=sum(y.^2)
>
> Dinesh

Hi Dinesh, The problem is you should set the dwtmode() to 'per'. If the dwtmode() is the default value of 'sym', the pythagorean theorem for the orthogonal decomposition of the signal into the approximation and detail coefficients will not hold. Also, you should use randi()--randint is obsolete.

dwtmode('per','nodisplay')
reset(RandStream.getDefaultStream);
str = 'db2';
r = randi(10,10,1);
r = r./norm(r,2);
[A,H]=dwt(r,str);
norm(A,2)^2+norm(H,2)^2

% ans = 1.0000

Hope that helps,
Wayne

Date Subject Author
10/27/10 Dinesh Bhati
10/27/10 Dinesh Bhati
10/27/10 Dinesh Bhati
10/28/10 Wayne King