Skip to content
Sambit Paul edited this page Dec 2, 2023 · 4 revisions

Smooth uses convolution with a specified kernel to smooth the input signal. It works in 2 modes:

  1. Rectangular: This is a uniform kernel. Eg: For size 5, kernel = $\frac{[1, 1, 1, 1, 1]}{size}$
  2. Triangular: This is a weighted kernel. Eg: For size 5, kernel = $\frac{[1, 2, 3, 2, 1]}{size}$

The examples provided here use this signal:

$\sin(4\pi t) + \sin(60\pi t)$

smooth

Rectangular

The parameters for this filter are as follows:

  • Mode of Operation ⇨ "rectangular"
  • Kernel Size ⇨ 11
Code
String mode = "rectangular";
int wsize = 11;
Smooth s1 = new Smooth(signal, wsize, mode);
double[] out = s1.smoothSignal();

Triangular

The parameters for this filter are as follows:

  • Mode of Operation ⇨ "triangular"
  • Kernel Size ⇨ 11
Code
String mode = "triangular";
int wsize = 11;
Smooth s1 = new Smooth(signal, wsize, mode);
double[] out = s1.smoothSignal();
Clone this wiki locally