I have a signal that I would like to copy when it:
1) starts at zero crossing going positive
2) copy a set number of points (like 8000)
function[t,s]=zerocorss(x,m)
if nargin<2
m='b';
end
s=x>0;
k=s(2:end)-s(1:end-1)
if any(m=='p')
f=find(k>0);
elseif (m=='n')
f=find(k<0);
else
f=find(k~=0);
end
s=x(f+1)-x(f);
f=f-x(f)./s;
if ~nargout
n=length(x);
subplot(2,1,1),plot(1:n,x,'x',t,zerocorss(length(x)/1),'o');
subplot(2,1,2),stem(t,s);
end
end