input of DWT and output of IDWT not same?

I tried to test out the dwt and idwt, before i used this code i've build my own formula to work on dwt and idwt. But i figured that my own formula for dwt and idwt the reconstructed value are not the same as the input. so i tried with the built in function.
A=wavread('tes.wav');
leftchanel=A(1:size(A),1);
[cA,cD] = dwt(leftchanel,'haar');
X = idwt(cA,cD,'haar');
check=leftchanel-X;
from this code i got check not all value are 0, that mean leftchanel is not the same as X ( the input for dwt and the output of idwt are mostly same but some are different ). The main question from me is "Aren't the after we decompose(DWT) and reconstruct(IDWT) the input and the output should be same (exactly same)?"

답변 (1개)

Wayne King
Wayne King 2013년 3월 13일
편집: Wayne King 2013년 3월 13일

0 개 추천

When you say they are not zero how large is the difference? You have to keep in mind that there may be small numerical differences. For example:
x = randn(1024,1);
[A,D] = dwt(x,'haar');
xrec = idwt(A,D,'haar');
max(abs(x-xrec))
For the above particular random signal, the largest absolute value of the difference is 10^{-16}. That is as equal as you can get.

댓글 수: 3

I Made
I Made 2013년 3월 13일
e.g i got : -3.46944695195361e-18, -1.73472347597681e-18, 6.93889390390723e-18
I don't know if that a large or small difference, is it small or large, will it make a big difference on the wav file i rewrite it?
Wayne King
Wayne King 2013년 3월 14일
e-18 means 10^(-18). That is an very small difference.
Hey i miss look (forget to look at the leftchanel and X), before i use
check=leftchanel-X;
The leftchanel and X is has the same value, but after i do above code i become has a very small difference that you say in check variable. how it can be? was it if
A[1 2 3 4 5] B[1 2 3 4 5]
then C=A-B; which should be 0? can have small difference because of datatype or anything?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

질문:

2013년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by