Filter löschen
Filter löschen

how can I convert one square wave to impulses ?

1 Ansicht (letzte 30 Tage)
Onur PEKER
Onur PEKER am 12 Mär. 2014
Bearbeitet: Onur PEKER am 12 Mär. 2014
I have the following picture and I want to convert it to impulse for counting how many picks there are. How can I count this picks ? , forexample # 4 for this picture .

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 12 Mär. 2014
Bearbeitet: Mischa Kim am 12 Mär. 2014
Onur, you could simply take the derivative of the signal, provided that it is somewhat well behaved. See example below:
t = 0:0.1:20;
x = square(t,5) + 0.1*rand(1,length(t)); % noisy square wave
val = +1; % deriv treshold value
num = length(find(diff(x)>val)); % data points with deriv > threshold
disp(num)
plot(t,x)
  1 Kommentar
Onur PEKER
Onur PEKER am 12 Mär. 2014
Bearbeitet: Onur PEKER am 12 Mär. 2014
Thank you for your kind answer This is what I searched.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by