⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 movingaverage.h

📁 人工智能的matlab程序
💻 H
字号:
#import <objectbase/SwarmObject.h>


@interface MovingAverage: SwarmObject
{
  int width;  /*"number of observations used for a fixed interval moving average"*/
  int numInputs; /*"number of observations that have already been inserted"*/
 
  
  double *maInputs; /*"historical inputs are kept in this array."*/
  int arrayPosition; /*"element of maInputs that has been most recently inserted"*/
  double sumOfInputs;/*"sum of the last 'width' inputs"*/
  double uncorrectedSum; /*"sum of all inputs since object was created"*/
 
  double expWMA;  //exponentially weighted moving average
  double aweight, bweight; /*"Weights used to calculate exponentially weighted moving averages.  These depend on the specified 'width' according to: bweight = -expm1(-1.0/w);aweight = 1.0 - bweight; ewma=aweight*ma(x)+bweight*x"*/

} 

- initWidth: (int)w;
- initWidth: (int)w Value: (double)val;

- (int)getNumInputs;

- (double)getMA;

- (double)getAverage;

- (double)getEWMA;

- (void)addValue: (double)x;

- (void)drop;

@end












⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -