sinewave.java

来自「这是个时间序列分段处理的程序」· Java 代码 · 共 32 行

JAVA
32
字号
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SineWave.java

package timeseries;

import java.util.Random;

// Referenced classes of package timeseries:
//            TimeSeries, TimeSeriesPoint

public class SineWave extends TimeSeries
{

    private static final Random rand = new Random();

    public SineWave(int length, double cycles, double noise)
    {
        super(1);
        for(int x = 0; x < length; x++)
        {
            double nextPoint = Math.sin(((double)x / (double)length) * 2D * 3.1415926535897931D * cycles) + rand.nextGaussian() * noise;
            super.addLast(x, new TimeSeriesPoint(new double[] {
                nextPoint
            }));
        }

    }

}

⌨️ 快捷键说明

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