Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-24
5
Medium Priority
?
155 Views
Last Modified: 2010-04-16
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

0
Comment
Question by:hsimola
5 Comments
 
LVL 4

Expert Comment

by:brunomsilva
ID: 9617861
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;
0
 
LVL 4

Expert Comment

by:nestorua
ID: 9619797
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.
0
 

Author Comment

by:hsimola
ID: 9625170
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.

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12388744
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question