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
Running average/sum questions
5 posts
• Page 1 of 1
Running average/sum questions
Hi, this is really basic but the answer eludes me - I want to make a module that creates a running average and a total sum- I have an integer value and a trigger for each time I want to collect a value to include in the sum and running average. I guess essentially I need to perform x=x+n each time the trigger goes.. Sorry if I am missing something obvious..
Thanks
Quentin
Thanks
Quentin
- Quentin
- Posts: 37
- Joined: Sat Jul 14, 2012 5:35 am
Re: Running average/sum questions
How's this?->
Hope it works for you 8D
Hope it works for you 8D
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Running average/sum questions
Thanks for the example, my problem that I don't want to build a huge array, just want to accumulate the sum of the values over a long period of time, sorry I realized after I posted that I should have explained this detail. Thanks again for the response..
Quentin
Quentin
- Quentin
- Posts: 37
- Joined: Sat Jul 14, 2012 5:35 am
Re: Running average/sum questions
Hi Quentin,
This example should do what you want without eating up unnecessary memory...
This example should do what you want without eating up unnecessary memory...
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Running average/sum questions
Thanks so much, that is exactly what I was in the process of trying to piece together in ruby- I am new to ruby so it's slow going for me- so your timing could not be better with that example..
Quentin
Quentin
- Quentin
- Posts: 37
- Joined: Sat Jul 14, 2012 5:35 am
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 79 guests