Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;

public class Main {
    public static double[] planckTaperWindow(int length, double e) {
        if (length < 1 || e <= 0 || e >= 0.5f) {
            return null;
        }
        double[] planckTaperWindow = new double[length];
        Arrays.fill(planckTaperWindow, 1);
        planckTaperWindow[0] = 0;
        planckTaperWindow[length - 1] = 0;
        for (int i = 1; i < e * (length - 1); i++) {
            double za = e * (length - 1) * (1.0f / i + 1.0f / (i - e * (length - 1)));
            planckTaperWindow[i] = 1.0f / (Math.exp(za) + 1);
        }
        for (int i = (int) (1 - e) * (length - 1); i < length - 1; i++) {
            double zb = e * (length - 1) * (1.0f / (length - 1 + i) + 1.0f / ((1 - e) * (length - 1) * (i)));
            planckTaperWindow[i] = 1.0f / (Math.exp(zb) + 1);
        }
        return planckTaperWindow;
    }
}