Package htw.ai.dln.utils
Class SignalUtils
- java.lang.Object
-
- htw.ai.dln.utils.SignalUtils
-
public class SignalUtils extends java.lang.Object- Since:
- : 26.02.21
- Version:
- : 1.0
- Author:
- : Enrico Gamil Toros Project name : apt-decoder
-
-
Constructor Summary
Constructors Constructor Description SignalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublecorrelation(int[] x, int[] y)Function that returns correlation coefficient.static double[]crudeLowPass(double[] signal, double frequency, double frequencyCut)Low Pass Filter.static voidplotSignal(double[] signal, int samplesToPlot)Plot a signal to a graph Is saved at project source rootstatic voidplotSignals(double[] signal, double[] signal2, int samplesToPlot)Plots two signals (1 in blue, 2 in orange) Is saved at project source root
-
-
-
Method Detail
-
plotSignal
public static void plotSignal(@NotNull double[] signal, int samplesToPlot)Plot a signal to a graph Is saved at project source root- Parameters:
signal- Signal to plot, can't be nullsamplesToPlot- number of samples to plot- Throws:
java.lang.IllegalArgumentException- if samplesToPlot is > signal.length
-
plotSignals
public static void plotSignals(@NotNull double[] signal, @NotNull double[] signal2, int samplesToPlot)Plots two signals (1 in blue, 2 in orange) Is saved at project source root- Parameters:
signal- Signal 1signal2- Signal 2samplesToPlot- number of samples to plot- Throws:
java.lang.IllegalArgumentException- if samplesToPlot is > signal.length
-
correlation
public static double correlation(@NotNull int[] x, @NotNull int[] y)Function that returns correlation coefficient.- Parameters:
x- array x, must have same length as yy- array y, must have same length as x- Returns:
- value between -1 and 1 - 1 X and Y are negatively correlated + 1 X and Y are positively correlated
-
crudeLowPass
public static double[] crudeLowPass(double[] signal, double frequency, double frequencyCut)Low Pass Filter. Needs improvements- Parameters:
signal- Signalfrequency- FrequencyfrequencyCut- Frequency to cut- Returns:
- Low Pass Filtered Signal
-
-