15,746,652 members
Home / Discussions / C#

C#

 Re: Implementing a moving average Ralf Meier15-Feb-18 0:25 Ralf Meier 15-Feb-18 0:25
 Re: Implementing a moving average Rob Philpott15-Feb-18 0:24 Rob Philpott 15-Feb-18 0:24
 Re: Implementing a moving average OriginalGriff15-Feb-18 0:34 OriginalGriff 15-Feb-18 0:34
 Re: Implementing a moving average auting8215-Feb-18 1:38 auting82 15-Feb-18 1:38
 Re: Implementing a moving average OriginalGriff15-Feb-18 1:53 OriginalGriff 15-Feb-18 1:53
 Re: Implementing a moving average auting8215-Feb-18 4:35 auting82 15-Feb-18 4:35
 Re: Implementing a moving average OriginalGriff15-Feb-18 4:53 OriginalGriff 15-Feb-18 4:53
 Re: Implementing a moving average Ralf Meier15-Feb-18 21:27 Ralf Meier 15-Feb-18 21:27
 There is also another way to build this Average without using an array - but the base-problem is the same : it is necessary to know what the code does and how it works. Independant from this - here is another Code-Solution : C# ```int CountAct = 0; double ValueLast = 0; public double getAverage(double actValue, int Smoothing) { if (Smoothing < 1) Smoothing = 1; CountAct = Math.Min(CountAct + 1, Smoothing); double myDivider = Math.Max((double)CountAct - 1, 0); double Result = (ValueLast * myDivider + actValue) / (myDivider + 1); ValueLast = Result; return Result; } ``` Here you can build an average from as much values you like - you only have to tell the method the smoothing-value you like to have ...modified 16-Feb-18 6:33am.
 Re: Implementing a moving average auting8216-Feb-18 1:25 auting82 16-Feb-18 1:25
 Re: Implementing a moving average Pete O'Hanlon16-Feb-18 7:53 Pete O'Hanlon 16-Feb-18 7:53
 Re: Implementing a moving average Ralf Meier16-Feb-18 9:49 Ralf Meier 16-Feb-18 9:49
 Re: Implementing a moving average auting8216-Feb-18 11:40 auting82 16-Feb-18 11:40
 Re: Implementing a moving average Ralf Meier16-Feb-18 12:42 Ralf Meier 16-Feb-18 12:42
 Re: Implementing a moving average Ralf Meier17-Feb-18 0:14 Ralf Meier 17-Feb-18 0:14
 Re: Implementing a moving average auting8217-Feb-18 0:36 auting82 17-Feb-18 0:36
 Re: Implementing a moving average Ralf Meier17-Feb-18 0:53 Ralf Meier 17-Feb-18 0:53
 Re: Implementing a moving average auting8217-Feb-18 1:13 auting82 17-Feb-18 1:13
 Re: Implementing a moving average Ralf Meier17-Feb-18 3:30 Ralf Meier 17-Feb-18 3:30
 Re: Implementing a moving average Ralf Meier17-Feb-18 3:50 Ralf Meier 17-Feb-18 3:50
 Re: Implementing a moving average auting8217-Feb-18 7:40 auting82 17-Feb-18 7:40
 Re: Implementing a moving average Ralf Meier17-Feb-18 10:11 Ralf Meier 17-Feb-18 10:11
 Re: Implementing a moving average auting8218-Feb-18 8:40 auting82 18-Feb-18 8:40
 Re: Implementing a moving average Ralf Meier18-Feb-18 9:32 Ralf Meier 18-Feb-18 9:32
 Re: Implementing a moving average auting8227-Feb-18 21:33 auting82 27-Feb-18 21:33
 Re: Implementing a moving average Gerry Schmitz15-Feb-18 8:16 Gerry Schmitz 15-Feb-18 8:16
 Last Visit: 31-Dec-99 18:00     Last Update: 30-Sep-23 10:50 Refresh ᐊ Prev1...443444445446447448449450451452 Next ᐅ