% exa_chirp adapted spline approximation of the chirp signal
%
% This example generates a nonuniform spline space adapted to a chirp signal and 
% constructs a dictionary for sparse approximation of the chirp through refinements of 
% OOMP and OMP approaches.  
sp = [ 0 8 ]; 
L = 2049; 
x = linspace( sp(1), sp(2), L ); 
f = cos( 2*pi*x.^2 );  % Generate the chirp on the interval [0 8]  
partition = ProducePartition( sp(1), sp(2), f, 9 );  % Adapted partition  
nD = CutDic( partition, 4, L, 10 );  % Generate dictionary 
tol = 0.01*norm(f);
[ DS0, Di0, beta0, c0, Q0 ] = OMPFinalRefi( f, nD, tol );  % Refinement for OMP() 
plot( x, f, x, c0*DS0(:,1:size(beta0,2))' );  % Plot the chirp and the approximation 
[ DS0, Di0, beta0, c0, Q0 ] = OOMPFinalRefi( f, nD, tol );  % Refinement for OOMP() 
figure;
plot( x, f, x, c0*DS0(:,1:size(beta0,2))' );  % Plot the chirp and the approximation 
