figure(1); clf; 

[b, a] = butter(1, [0.25 0.35])
[fresponse, ffreq] = freqz(b,a,300);
loglog( ffreq/pi*4000,abs(fresponse),'color','b', 'linewidth',2)
hold on
data =[
200 0.06641;
400 0.14062;
800 0.39844;
900 0.52734;
1000 0.69922;
1100 0.90625;
1200 0.99609;
1300 0.88281;
1600 0.46875;
2500 0.14844;
3200 0.07031];
loglog(data(:,1), data(:,2), 'b^','markersize',7,'markerfacecolor','b')

[b, a] = butter(1, [0.20 0.25])
[fresponse, ffreq] = freqz(b,a,300);
plot( ffreq/pi*4000,abs(fresponse),'color','r', 'linewidth',2)
hold on

data =[
200 0.05078;
400 0.12500;
800 0.65234;
900 0.94531;
1000 0.67969;
1100 0.45312;
1200 0.33203;
1300 0.26172;
1600 0.16016;
2500 0.06250;
3200 0.02734];
plot(data(:,1), data(:,2), 'r^','markersize',7,'markerfacecolor','r')

legend('bandpass [1000 1400] exact', '[1000 1400] measured','bandpass [800 1000] exact', '[800 1000] measured' )



%%% 4 pole stuff
figure(2); clf; 
[b, a] = butter(2, [0.2 0.3])
[fresponse, ffreq] = freqz(b,a,300);
plot( ffreq/pi*4000,abs(fresponse),'color','b', 'linewidth',2)
hold on

data =[
200 0.02734;
400 0.05469;
800 0.66016;
900 .917;
1000 0.96094;
1100 0.95703;
1200 0.71484;
1300 0.44922;
1600 0.14844;
2500 0.03516;
3200 0.02344];

plot(data(:,1), data(:,2), 'b^','markersize',7,'markerfacecolor','b')
%%%

[b, a] = butter(2, [0.2 0.4])
[fresponse, ffreq] = freqz(b,a,300);
plot( ffreq/pi*4000,abs(fresponse),'color','r', 'linewidth',2)
hold on
data =[
200 0.02344;
400 0.08984;
800 0.67578;
900 0.88281;
1100 0.98437;
1200 0.99219;
1300 0.98047;
1600 0.67187;
2500 0.09375;
3200 0.02344];
plot(data(:,1), data(:,2), 'bo','markersize',7,'markerfacecolor','r','markeredgecolor','r')
legend('bandpass [800 1200] exact', '[800 1200] measured','[800 1600] exact', '[800 1600] measured' )

[b, a] = butter(2, [0.15 0.1915])
[fresponse, ffreq] = freqz(b,a,500);
plot( ffreq/pi*4000,abs(fresponse),'color','g', 'linewidth',2)
hold on
data =[
200 0.00781;
300 0.10547;
500 0.23047;
550 0.35547;
600 0.49609;
650 0.56250;
700 0.72266;
750 1.27734;
900 0.30859;
1000 0.19141;
1200 0.14062];
plot(data(:,1), data(:,2), 'go','markersize',7,'markerfacecolor','g','markeredgecolor','g')
legend('bandpass [800 1200] exact', '[800 1200] measured',...
    '[800 1600] exact', '[800 1600] measured',...
    '[600 780] exact', '[600 780] measured')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 2 pole lowpass
return
figure(3); clf; 
[b, a] = butter(2, 0.25)
[fresponse, ffreq] = freqz(b,a,300);
plot( ffreq/pi*4000,abs(fresponse),'color','b', 'linewidth',2)
hold on

data =[
200 0.99219;
400 0.98437;
800 0.84375;
900 0.77734;
1000 0.67969;
1100 0.62500;
1200 0.55078;
1300 0.47656;
1600 0.28125;
2500 0.07422;
3200 0.019534];

plot(data(:,1), data(:,2), 'b^','markersize',7,'markerfacecolor','b')
%%%

[b, a] = butter(2,0.10)
[fresponse, ffreq] = freqz(b,a,300);
plot( ffreq/pi*4000,abs(fresponse),'color','r', 'linewidth',2)
hold on

data =[
100 0.92969;
200 0.91016;
300 0.82422;
400 0.66797;
500 0.50000;
800 0.20703;
1100 0.10156;
1500 0.03516;
2200 0.00000;
2500 0.00000;
3200 0.00000];

plot(data(:,1), data(:,2), 'bo','markersize',7,'markerfacecolor','r','markeredgecolor','r')
legend('lowpass 1000 exact', '1000 measured','lowpass 400 exact', '400 measured' )

