public void RunTest() { var interval = new float2(0, 20); var sampleNum = 10; var start = new Tuple <float, float>(0, 10); var end = new Tuple <float, float>(0, 20); var y = new Vector <float>(sampleNum); for (var i = 0; i < sampleNum; ++i) { y[i] = i; } var func = new X2FDiscreteFunction <float>(5, 20, y); var t = 4f; var dt = 1;//func.End.Item1-func.Start.Item1)/(sampleNum-5); var ret = ""; for (var i = 0; i < sampleNum * 2; ++i) { t += dt; ret += "(" + t + " " + func.Evaluate(t) + ") "; } LogTool.Log(ret); }
public ActivationData(float2 interval, int sampleNum) { var start = new Tuple <float, float>(interval.x, 0); var end = new Tuple <float, float>(interval.y, 0); this.discreteFunction = new X2FDiscreteFunction <float>(start, end, sampleNum); this.fftData = new FFTData(this.DiscreteFunction); this.tuningData = new TuningData(); this.fftData.GenerateFFTData(); }
void Start() { var interval = new float2(0, 20); var sampleNum = 10; var start = new Tuple <float, float>(0, 10); var end = new Tuple <float, float>(0, 20); var y = new Vector <float>(sampleNum); for (var i = 0; i < sampleNum; ++i) { y[i] = math.sin((i * 1f / (sampleNum - 1)) * math.PI) * 10; } this.test = new X2FDiscreteFunction <float>(5, 20, y); this.curve = this.test.ToAnimationCurve(); }
public void FromAnimationCurve(AnimationCurve curve) { this.discreteFunction = new X2FDiscreteFunction <float>(curve); this.fftData = new FFTData(this.DiscreteFunction); this.fftData.GenerateFFTData(); }
public FFTData(X2FDiscreteFunction <float> activation) { this.sourceFunction = activation; }