% Example, Time-Frequency Analysis course
% Best basis with Shannon entropy and lp-norm cost functions
t=[1:1024]./512;
l=4
[h,g,rh,rg]=daub(l);

n=64;
x=zeros(1,1024);
for s=2:2:6
x=sin(2.017*n*s/2*pi*(t))+x;
end
x(300)=25+x(300);
x(500:700)=x(500:700)+ones(size(x(500:700)));
x(900)=15+x(900);
figure
plot(t,x)

[b,y,total]=pruneadd(x,h,g,'shanent');

figure
tfp4(b,y)

[b,y,total]=pruneadd(x,h,g,'lpenerg',1.5);

figure
tfp4(b,y)

figure
specgram(x)
colormap(1-gray)