[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/ailvcheng/Java/master/Maths/Convolution.java [Back]  [Original]

package com.maths;

/**
 * Class for linear convolution of two discrete signals
 *
 * @author Ioannis Karavitsis
 * @version 1.0
 */
public class Convolution {
  /**
   * Discrete linear convolution function. Both input signals and the output signal must start from
   * 0. If you have a signal that has values before 0 then shift it to start from 0.
   *
   * @param A The first discrete signal
   * @param B The second discrete signal
   * @return The convolved signal
   */
  public static double[] convolution(double[] A, double[] B) {
    double[] convolved = new double[A.length + B.length - 1];

    /*
    The discrete convolution of two signals A and B is defined as:

          A.length
    C[i] =  (A[k]*B[i-k])
          k=0

    It's obvious that:  0 

Web Proxy Viewer  |  New URL  |  Original Page