Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

http://en.wikipedia.org/wiki/Daubechies_wavelet#Transform.2C_D4

I find it is difficult to understand the pseudo-code on this Wiki page.

N = length(S);
s1 = S(1:2:N-1) + sqrt(3)*S(2:2:N);
d1 = S(2:2:N) - sqrt(3)/4*s1 - (sqrt(3)-2)/4*[s1(N/2); s1(1:N/2-1)];
s2 = s1 - [d1(2:N/2); d1(1)];<<<<<<<<<<<<<<<<<<<<<<<
s = (sqrt(3)-1)/sqrt(2) * s2;
d = (sqrt(3)+1)/sqrt(2) * d1;

I do not understand what does the square-bracket means.

share|improve this question
1  
I think the best way to understand the code is to implement it in Matlab. Can you do that? –  Nana Jun 20 '11 at 6:41
add comment

2 Answers

up vote 3 down vote accepted

The pseudo code is heavily using Matlab syntax. The square brackets mean concatenation of vectors. In this case you take the vector d1 (which is supposed to be a row vector), extract the second to N/2the entries and put the first entry of d1 below these.

share|improve this answer
add comment

To complement Dirk's answer, note that:
S(1:2:N-1) selects the 1st, 3rd and N-1 rows of the column vector, S.
s1(N/2) selects the N/2 row of s1 whereas s1(1:N/2-1) selects the 1st and N/2-1 rows of s1.

Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.