I am trying to find the counts per minute of a geiger counter signal using Simulink.
I managed to get the signal in a digital/binary form shown below:
I want to figure out how many pulses there are in a given timefram (1-3 seconds)

답변 (1개)

madhan ravi
madhan ravi 2023년 12월 14일
편집: madhan ravi 2023년 12월 14일

0 개 추천

Let A be your Interval test signal in timeseries format. Then
Pulses_1_3secs = nnz(out.A.Data((out.A.Time >= 1) & (out.A.Time <= 3))

댓글 수: 4

Robert
Robert 2023년 12월 14일
I wanted the time average to be rolling, like from 0-2 seconds is ? pulses, 2-4 seconds is ? pulses, etc. I would assume that I would just use a for loop and counter, right.
There are other ways, but yeah, that would work. In each 2 second period, are there the same number of samples (not counts but sample times or elements of your detection vector)? If so, you could use reshape:
data2d = reshape(data1D, numSamplesIn2Sec, []);
countsIn2Secs = sum(data2d, 1);
Robert
Robert 2023년 12월 15일
By the way, I am using Simulink, so the method that you proposed may not work.
madhan ravi
madhan ravi 2023년 12월 15일
The block under sum block in the second pic is *Unit Delay* block.
The first PWM block *Run at fixed interval* is ticked as model runs at fixed sample time.

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

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

2023년 12월 14일

댓글:

2023년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by