[SOLVED] any body can help me for getting no. of ZERO CROSSINGS of a signal

Status
Not open for further replies.

harithota20

Junior Member level 2
Joined
Jul 22, 2010
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
kolkata
Activity points
1,397
how to find the no. of zero crossings of a random signal in matlab.
i am using this code, but i am not getting the exact answer,

function zc=zcr(sig,N)
clear all;
fid=fopen('C:\Documents and Settings\Measurement lab\Desktop\imf1.txt');
data=fread(fid,1000,'bit4');
plot(data(1:100));
grid on;
sig = data;
thresh = 0;
N = length(sig);
zc = (sig >= thresh) - (sig < thresh);
count = sum((zc(1:N-1) - zc(2:N)) ~= 0);
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…