# Counting frequency of samples (numbers) - Search when values goes over 100

on
Hi,

I am trying to make code which looks for "rising edges" of numbers stored in array.

I mean "rising edge" is first value over 100.

Code must increase some integer variable until "rising edge" have found. Then in resets integer variable to zero and continues looking for next "rising edge" with same time again increasing ineteger variable....and so on until all samples have gone thru.

So, basicly I am trying to calculate frequency of when sample value is over 100 fisrt time - rising edge.

i am looking for very fast code for this.

Example samples from array:

3
15
14
19
23
24
32
29
41
30
74
235
246
238
238
230
232
223
226
216
221
197
35
4
18
15
24
23
30
31
34
39
38
190
255
234
242
231
232
226
223
223
213
225
89
0
20
12
22
23
26
32
29
44
25
127
255
237
242
234
231
230
222
226
211
229
150
5
15
14
19
24
24
32
29
40
30
71
232
246
238
239
230
232
224
225
217
220
201
40
3
18
14
24
23
29
31
33
40
35
182
255
234
242
231
232
227
223
224
212
226
95
0
20
12
22
23
26
33
29
44
25
121
255
237
241
234
231
230
222
227
212
228
158
8
13
15
18
24
24
32
29
40
32
65
227
248
237
239
230
232
224
225
218
219
205
45
2
19
14
24
23
29
31
33
41
33
176
255
234
242
231
232
227
222
224
211
228
105
0
19
13
22
23
26
33
29
44
25
112
252
238
241
235
231
230
222
227
212
228
164
10
12
15
18
24
24
31
29
39
33
60
222
250
237
240
230
232
224
225
218
218
209
50
1
19
14
24
23
29
32
32
42
31
172
255
234
242
232
232
228
222
225
211
229
109
0
19
12
21
23
25
32
29
44
25
109
251
239
241
235
231
230
222
226
212
227
168
13
11
15
17
24
23
31
29
38
34
56
218
251
236
240
230
232
224
225
219
217
211
54
0
19
13
23
23
28

Comment
Watch Question

Do more with

EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
this is just a simple approach, not sure if that's what you wanted. your question was a bit confusing

var x: array [1..1000] of integer;
i: integer;
edgePos: integer;
begin
edgePos := 0;
for i:= 1 to 1000 do
begin
inc(edgePos);
if x[i]>100 then
begin
// print edgePos
edgePos := 0;
end;
end;
end;

Commented:
HI,
Try to explain your question once more. Give two or three examples of arrays and what freaquency you get for these very examples.
Sincerely,
Nestorua.

Commented:
Hi,

I am trying to use following code for frequency counting :

http://www-tcsn.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20741065.html

I feed square wave to MIC input and try to calculate frequency between pulses rising edges.

Commented:
PAQed, with points refunded (250)

Computer101