% script heavyside
k = input('size of problem: (2*k) ');
m = 2^k; n = 2*m;
A = linspace(0,360,n+1);
x=zeros(n+1,1);
x(m+2:n) = 1;
x(m+1) = .5;
x(1) = .5; x(n+1) = .5;
toc
flops(0);tic;
y2 = DFT(x(1:n),1);
flops
P2 = struct('a',real(y2(1:m+1)),'b',-imag(y2(2:m-1)));
P2.a(1)=P2.a(1)/2;P2.a(m+1)=P2.a(m+1)/2;
Bvals = linspace(178,182,2000)';
Gvals = CSeval(P2,360,Bvals);
plot(Bvals,Gvals,A,x,'o')
axis([178 182 .8 1.2])
set(gca,'xTick',linspace(0,360,13))
