Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

comparing elements in array

For general discussion related FlowStone

comparing elements in array

Postby tester » Thu Mar 27, 2014 10:11 pm

I'm looking for an efficent solution for finding a single "peak" value within a small array (less than 50 elements). While I could do this with greens - at 25fps and some other stuff going on - I think ruby may be faster on that. Here it is what I exactly look for.

Let say that I have an array of floats, like this:

121
90
77
66
51
30
37
43
51
43
36
22
10

In above example - the peak is at index 8.

Concept:

- peak is a value at index N, greater than values at N-1 and N+1 indexes
- there will be only a one single peak in such array
- border values (lowest and highest) are never a peak values
- peak value does not have to be "max" in array (otherwise - it would be simple)

- it has to be efficient calculation (25fps or more), thus parsing the whole array per each comparison should not be done by greens, rather ruby.
Last edited by tester on Fri Mar 28, 2014 12:39 am, edited 1 time in total.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: comparing elements in array

Postby KG_is_back » Thu Mar 27, 2014 11:37 pm

It is called local maximum. No ruby needed...
Attachments
local maximum.fsm
(878 Bytes) Downloaded 730 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: comparing elements in array

Postby tester » Fri Mar 28, 2014 12:37 am

Thanks, I did not knew that it's possible that way.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet


Return to General

Who is online

Users browsing this forum: No registered users and 98 guests