-
-
Notifications
You must be signed in to change notification settings - Fork 43
Convolution & Cross Correlation
Sambit Paul edited this page Oct 26, 2024
·
12 revisions
Convolution works in 3 modes:
- Full: This returns the convolution at each point of overlap between kernel and signal.
- Same: This returns the convolution such that it maintains the same size as the original signal.
- Valid: This returns the convolution for the point where the kernel and the signal overlap completely.
The parameters for this filter are as follows:
- Mode of Operation ⇨ Can be "full", "same", "valid"
- Kernel ⇨ 1-D Array the signal is convolved with
String mode = "full"; //Can be "valid", "same"
Convolution con = new Convolution(signal, kernel);
double[] out = con.convolve(mode);
Fast Convolution (which is real convolution but done using Fourier method) works in 3 modes:
- Full: This returns the convolution at each point of overlap between kernel and signal.
- Same: This returns the convolution such that it maintains the same size as the original signal.
- Valid: This returns the convolution for the point where the kernel and the signal overlap completely.
The parameters for this filter are as follows:
- Mode of Operation ⇨ Can be "full", "same", "valid"
- Kernel ⇨ 1-D Array the signal is convolved with
String mode = "full"; //Can be "valid", "same"
Convolution con = new Convolution(signal, kernel);
double[] out = con.fastConvolve(mode);
Convolution works in 3 modes:
- Full: This returns the convolution at each point of overlap between kernel and signal.
- Same: This returns the convolution such that it maintains the same size as the original signal.
- Valid: This returns the convolution for the point where the kernel and the signal overlap completely.
The parameters for this filter are as follows:
- Mode of Operation ⇨ Can be "full", "same", "valid"
- Kernel ⇨ 1-D Array of the signal is convolved with. Can be complex or double.
mode = "full";
Complex[] sg = UtilMethods.matToComplex(complexSignal);
Complex[] krn = UtilMethods.matToComplex(complexKernel);
ComplexConvolution c1 = new ComplexConvolution(sg, krn);
double[][] out = UtilMethods.complexTo2D(c1.convolve(mode));
Works in the exact same way as convolve.
The parameters for this filter are as follows:
- Mode of Operation ⇨ Can be "full", "same", "valid"
- Kernel ⇨ 1-D Array the signal is cross-correlated with
String mode = "full"; //Can be "valid", "same"
CrossCorrelation cc = new CrossCorrelation(signal, kernel);
double[] out = cc.crossCorrelate(mode);
Works in the exact same way as convolve.
The parameters for this filter are as follows:
- Mode of Operation ⇨ Can be "full", "same", "valid"
- Kernel ⇨ 1-D Array the signal is cross-correlated with
String mode = "full"; //Can be "valid", "same"
CrossCorrelation cc = new CrossCorrelation(signal, kernel);
double[] out = cc.fastCrossCorrelate(mode);
Performs autocorrelation using the cross-correlation process.
CrossCorrelation cc = new CrossCorrelation(signal);
double[] out = cc.crossCorrelate(mode); //Or use cc.fastCrossCorrelate(mode)
Wiki
-
Filters
- IIR Filters
- FIR Filters
- Kernel-Based Filter
- Adaptive Filters
-
Signals
-
Peak Detection
-
Transformations
-
Speech
-
Windowing