Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to find every cycle in matlab?

Status
Not open for further replies.

Poison_83

Newbie level 6
Joined
Apr 26, 2007
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,366
I have a periodic signal with increasing frequency over time, now I want to divide the signal to every periodic cycle and analyze it separate.
For example, in the begining of the signal the periodic time can be 100ms and in the end it can be 10ms, but i want a program to look at just one period independent of the frequency.
How do I get this in an easy way with Matlab or C?
Thanks
 

I'm not sure I understand what you mean by "look at just one period", but maybe this example will help you. It generates a frequency sweep, and then tabulates the waveform's positive-slope zero-crossing points. You can copy-and-paste the code directly into your MATLAB Command Window.
Code:
% Frequency sweep
F0 = 10;        % start frequency, Hertz
F1 = 100;       % stop frequency, Hertz
T  = 0.5;       % duration, seconds
FS = 1000;      % sample rate, Hertz
N = round(T * FS);
t = T * (0:N-1)' / (N-1);
y = sin(2 * pi * (F0 + (F1 - F0) / 2 .* t / T) .* t);
subplot(2,1,1); plot(t, y); xlabel('seconds');
%
% Positive-slope zero-crossing detector
z = and((y > 0), not(circshift((y > 0), 1)));  z(1) = 0;
subplot(2,1,2); plot(t, z); xlabel('seconds');
%
% Find the locations of the zero-crossing points
crossing_points = find(z);
 

    Poison_83

    Points: 2
    Helpful Answer Positive Rating
Thank you!
Yes the code seems to work quite like a want.

The target is to measure the peakvalue of every period and then compare to each other.
 

Hi
May be wavelet or short time fourier transform (STFT) can help u.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top