Sign in

Not a member? | Forgot your Password?

Search matlab

Search tips

Subscribe to matlab

Search tips

Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

Discussion Groups

IIR Filter Design Software

See Also

Embedded SystemsFPGA

Discussion Groups | Matlab DSP | Zero-Crossing..

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread



Is this thread worth a thumbs up?

0

Zero-Crossing.. - s7jid - Jan 4 14:10:00 2004

All,

Can anyone tell me how to find number of zero crossing (i.e. number
of time signal changes sign) in matlab?

Regards







Re: Zero-Crossing.. - Mandar Rahurkar - Jan 5 21:17:00 2004

use the sign command and find the number of transitions.

Mandar

--- s7jid <> wrote:
> All,
>
> Can anyone tell me how to find number of zero crossing (i.e. number
>
> of time signal changes sign) in matlab?
>
> Regards =====
-------------------------------------
Its not life that weighs us down,
Its how we carry it.
------------------------------------

__________________________________






RE: Zero-Crossing.. - balaji srinivasan - Jan 6 1:42:00 2004


Try this.

count = 0;

thresh = 0;

for(i=0:signal_length){

if(sig[i+1]>thresh && sig[i]<=thresh) count++;

else if(sig[i+1]<thresh&& sig[i]>=thresh)count++;

end;

end;

}

count/=2;
#8216;Count#8217; will have the numberof #8216;zero crossings#8217;.
Bye
Balaji Srinivasan

-----Original Message-----
From: s7jid[mailto:]
Sent: Sunday, January 04, 20047:40 PM
To:
Subject: [matlab] Zero-Crossing..
All,

Can anyone tell me how to find number of zerocrossing (i.e. number
of time signal changes sign) in matlab?

Regards

_____________________________________
/groups.php3 Yahoo! Groups Sponsor

ADVERTISEMENT
--------------------------------- Yahoo!Groups Links

To
---------------------------------







RE: Zero-Crossing.. - ulas bagci - Jan 6 15:17:00 2004



one way is this

function [n] = zc(x)
% ZC number of zero crossings in x
%    [n] = zc(x) calculates the number of zero crossings in x
s=sign(x);
t=filter([1 1],1,s);
n=(length(s)-length(find(t)))/length(s);

or another way is

function zcr=zcr(x,dur)
% function zcr=zcr(x,dur) : compute zero-crossing rate
% x: input data
% dur: duration of the input data

[nf,len]=size(x);
zcr=sum(0.5*abs(sign(x(:,2:len))-sign(x(:,1:len-1))))/dur;

 

best regards

>From: "s7jid"

>To: m...@yahoogroups.com
>Subject: [matlab] Zero-Crossing..
>Date: Sun, 04 Jan 2004 14:10:25 -0000
>MIME-Version: 1.0
>X-Originating-IP: 195.92.168.167
>X-Sender: s...@yahoo.co.uk
>Received: from n2.grp.scd.yahoo.com ([66.218.66.75]) by mc10-f6.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 5 Jan 2004 07:41:56 -0800
>Received: from [66.218.66.156] by n2.grp.scd.yahoo.com with NNFMP; 05 Jan 2004 15:41:44 -0000
>Received: (qmail 17136 invoked from network); 5 Jan 2004 15:41:38 -0000
>Received: from unknown (66.218.66.166)  by m16.grp.scd.yahoo.com with QMQP; 5 Jan 2004 15:41:38 -0000
>Received: from unknown (HELO n24.grp.scd.yahoo.com) (66.218.66.80)  by mta5.grp.scd.yahoo.com with SMTP; 5 Jan 2004 15:41:38 -0000
>Received: from [66.218.67.180] by n24.grp.scd.yahoo.com with NNFMP; 05 Jan 2004 15:41:38 -0000
>Received: (qmail 25425 invoked from network); 4 Jan 2004 14:10:25 -0000
>Received: from unknown (66.218.66.217)  by m14.grp.scd.yahoo.com with QMQP; 4 Jan 2004 14:10:25 -0000
>Received: from unknown (HELO n7.grp.scd.yahoo.com) (66.218.66.91)  by mta2.grp.scd.yahoo.com with SMTP; 4 Jan 2004 14:10:25 -0000
>Received: from [66.218.67.178] by n7.grp.scd.yahoo.com with NNFMP; 04 Jan 2004 14:10:25 -0000
>X-Message-Info: JGTYoYF78jE8olZlBuY7iFQJ//URq6b1
>X-eGroups-Return: sentto-1287352-2657-1073317302-ulasbagci=h...@returns.groups.yahoo.com
>X-eGroups-Return: s...@yahoo.co.uk
>X-Apparently-To: m...@yahoogroups.com
>Message-ID:
>User-Agent: eGroups-EW/0.82
>X-Mailer: Yahoo Groups Message Poster
>X-eGroups-Remote-IP: 66.218.66.91
>X-Yahoo-Profile: s7jid
>X-eGroups-Approved-By: s_boucheryah via web; 05 Jan 2004 15:41:37 -0000
>X-eGroups-Remote-IP: 66.218.66.80
>Mailing-List: list m...@yahoogroups.com; contact m...@yahoogroups.com
>Delivered-To: mailing list m...@yahoogroups.com
>Precedence: bulk
>List-Unsubscribe:
>Return-Path: sentto-1287352-2657-1073317302-ulasbagci=h...@returns.groups.yahoo.com
>X-OriginalArrivalTime: 05 Jan 2004 15:41:56.0657 (UTC) FILETIME=[73267A10:01C3D3A2]
>
>All,
>
>Can anyone tell me how to find number of zero crossing (i.e. number
>of time signal changes sign) in matlab?
>
>Regards
>
>


The new MSN 8: smart spam protection and 2 months FREE*





RE: Zero-Crossing.. - Abdul Malik Khan - Jan 23 15:16:00 2004

If you want to avoid for loop the following code is
equivalent to balaji's code

thresh = 0;
N = length(sig);
zc = (sig >= thresh) - (sig < thresh);
count = sum((zc(1:N-1) - zc(2:N)) ~= 0);

> Date: Mon, 5 Jan 2004 17:42:37 -0800 (PST)
> From: balaji srinivasan <>
> Subject: RE: Zero-Crossing.. > Try this.
>
> count = 0;
>
> thresh = 0;
>
> for(i=0:signal_length){
>
> if(sig[i+1]>thresh &&
> sig[i]<=thresh) count++;
>
> else if(sig[i+1]<thresh&&
> sig[i]>=thresh)count++;
>
> end;
>
> end;
>
> }
>
> count/=2; >
> #8216;Count#8217; will have the numberof #8216;zero
> crossings#8217;. >
> Bye >
> Balaji Srinivasan >
>
> -----Original Message-----
> From: s7jid[mailto:]
> Sent: Sunday, January 04, 20047:40 PM
> To:
> Subject: [matlab] Zero-Crossing.. >
> All,
>
> Can anyone tell me how to find number of
> zerocrossing (i.e. number
> of time signal changes sign) in matlab?
>
> Regards
__________________________________