Page 143 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 143

3. Numerical Linear Algebra                                      131

           14.2.2   M-file for daubechies 4 forward and inverse transformation

              ___________________________________________________________
              daub4trans.m

              i=0:1/127:1;
              a=sin(2*pi*i)+sin(2*pi*100*i);
              plot(a)
              figure
              s=length(a);
              for i=1:1:log2(s) -2
                  a=[a a(1:2)];
                  i
                  temp=createdaubmatrix(length(a)-2)*a';
                  temp=temp(1:1:length(temp));
                  temp=reshape(temp,2,length(temp)/2);
                  approx{i}=temp(1,:);
                  det{i}=temp(2,:);
                  a=approx{i};
              end
              for k=1:1:(length(approx)-1)
              subplot((length(approx)-1),1,k)
              plot(approx{k})
              title(strcat('approx',num2str(k)))
              end
              figure
              for k=1:1:(length(approx)-1)
              subplot((length(approx)-1),1,k)
              plot(det{k})
              title(strcat('detail',num2str(k)))
              end
   138   139   140   141   142   143   144   145   146   147   148