how can I convert one square wave to impulses ?

조회 수: 2 (최근 30일)
Onur PEKER
Onur PEKER 2014년 3월 12일
편집: Onur PEKER 2014년 3월 12일
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 .

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 12일
편집: Mischa Kim 2014년 3월 12일
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
Onur PEKER
Onur PEKER 2014년 3월 12일
편집: Onur PEKER 2014년 3월 12일
Thank you for your kind answer This is what I searched.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by