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

4. Selected Applications                                         177

              s=256;
              signal=[];
              for k=1:1:length(I)
                  approx=col{k}{1};
              det=col{k}{2};
              app=approx{log2(s)-2};
              for i=(log2(s)-2):-1:1
                  a=[app;det{i}];
                  a=reshape(a,1,size(a,1)*size(a,2));
                  a=[ a(length(a)-1:1:length(a))  a];
                  app=createdaubinvmatrix(length(a)-2)*a';
                  app=app';
              end
              signal=[signal app];
              end
              figure
              subplot(3,1,1)
              plot(signal(1:1:5520));
              title('Original signal')
              subplot(3,1,2)
              plot(A(1:1:5520),'r');
              title('Watermarked signal');
              subplot(3,1,3)
              plot(signal(1:1:5520)-A(1:1:5520))
              title('Difference signal')

              save signal signal
              _________________________________________________________

              daub4water.m

              function [res]=daub4water(x)
              a=x;
              s=length(a);
              for i=1:1:log2(s) -2
                  a=[a a(1:2)];
                      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};
   183   184   185   186   187   188   189   190   191   192   193