Finding zero crossing that are going positive and zero crossing that are going negative

后端 未结 4 1740
攒了一身酷
攒了一身酷 2021-01-06 01:36

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)

4条回答
  •  天命终不由人
    2021-01-06 02:30

    You can do like this to find "going-up" or "going-down" zero crossings:

    %find zero crossings
    t1=y(1:n-1);
    t2=y(2:n);
    tt=t1.*t2;
    indx=find(tt<0)
    
    dt        = t2-t1;
    indx_up   = find( (tt<0) & (dt>0) ) 
    indx_down = find( (tt<0) & (dt<0) ) 
    

提交回复
热议问题