%Sinc_examp
%comparison between fundamental splines and sinc function



type_gen=1
lole1=input('loglength of signal;0--former; ?')
if lole1>0
    lole=lole1;
    N=2^lole;
end
shi=1;%input('shift to the center--1; ?')
Ll1=input('number of levels;0--former; ?')
if Ll1>0
    Ll=Ll1;
    M=N*2^Ll;
end
Par1=input('spline order;0--former; ?')
if Par1>0
    P=Par1;
end

rho=0
[spli]=spligenP(1,P,N,Ll,rho);

[u1,v]=juviP(P,N);
n=0:N-1;a=((sin(pi*n/N))./(pi*n/N)).^P./u1;
a1=fliplr(a(1:end));
fspli=[a1,a];


x=(1:M)-M/2;y=x/2^Ll;

figure;
subplot(1,2,1)
plot(y,sinc(y),'r','LineWidth',2);
hold on 

plot(y,spli,'LineWidth',2);

ma=min(spli);Ma=max(spli);
axis([-30 30 ma-.1 Ma+.1])
[u1,v]=juviP(P,N);
n=0:N-1;a=((sin(pi*n/N))./(pi*n/N)).^P./u1;
a1=fliplr(a(1:end));
fspli=[a1,a];
subplot(1,2,2)
ma=max(a);
plot(fspli,'LineWidth',2);  
axis([0 2*N  0 ma+.1])
set(gca,'XTick',0:N/2:2*N)
set(gca,'XTickLabel',{'-N','-N/2','0','N/2','N'})
%set(gca,'XTickLabel',{'0','N/4','N/2'})
% end
% %hold on

