function [x] = myfiltfilt(b,a,x)
%function myfiltfilt[b,a,x]
% routine to do two-pass recursive filter using filtfilt.m 
%  but with the data padded to have an extended head and tail of
%  constant data to try and minimize wobbles of the output at the ends

L=length(x);
z1=x(1)*ones(1000,1);
z2=x(L)*ones(1000,1);

y=[z1',x',z2'];

z=filtfilt(b,a,y);

x=z(1001:1000+L);

return

