Application of the Savitzky-Golay filter in multi-spectral signal processing

ABSTRACT


INTRODUCTION
Multi-spectral signals are the result of the interaction between electromagnetic energy and an object.Multi-spectral is also referred to as an image that uses several spectra [1], [2].In multi-spectral signals, conditions are found which are called fluctuations which are caused by noise that interferes with the data.The fluctuation pattern is a state of inaccuracy or the rise and fall of peak amplitude values in certain data through the data acquisition process, where the fluctuations that occur are very complex due to the data obtained through the acquisition process being mixed with noise [3], [4].Therefore, processing of signal fluctuation patterns is required so that the results of these fluctuations can be identified.
This study uses pure water (H2O) as a platform or measuring platform which has previously been used as material in previous research [5]- [7].The H2O material produces fluctuation patterns that are obtained through the Multi-Spectral Capacitive Sensor (MSCS), which is a capacitive sensor that works based on the principle of impedance spectroscopy.[6].There are three types of fluctuation patterns produced, namely Mean Fluctuation (MF), High Fluctuation (HF) and High-High Fluctuation (HHF).In this research, the signal fluctuation pattern used is HF, because this pattern shows a more fluctuating state and shows the dominant characteristics of a material [8].
From this research, it is hoped that it can produce clearer signal fluctuation patterns from the test material using the Savitzky-Golay filter, which reduces noise by smoothing the signal.[9]- [11].The reason for using the Savitzky-Golay filter is that it is a method that can refine signals to obtain important patterns in the data by removing noise in the data so that good and clear fluctuation patterns are displayed on the signal graph [12].
Evaluating the quality of a multi-spectral signal requires an objective assessment, namely calculating the Signal to Noise Ratio (SNR) and Mean Square Error values (MSE) [13].By calculating the SNR value on the signal, it can be seen that the filter works well in suppressing noise, seen based on the larger SNR value after the signal is filtered and the small MSE value for each respondent [14].
The fluctuation pattern has very unique characteristics.This can be seen from the form obtained in previous research [15].Several previous studies have conducted research on fluctuation pattern identification systems, especially High Fluctuation (HF) fluctuation patterns from H2O materials by utilizing Multi-Spectral Capacitive Sensor (MSCS) capacitive sensors, as has been done by previous research [5], [7].
Segmentation is one of the efforts that has been carried out to identify fluctuation patterns so that the unique characteristics of HF patterns will be more easily recognized and analyzed [16].Segmentation methods have also been used by several studies [17]- [19].However, the weakness is that this study does not directly use data sets of fluctuation patterns in the form of matrices for analysis.
To date, there are not many studies that discuss the fluctuation pattern segmentation approach.However, the author tries to apply the Savitsky-Golay filter to the HF fluctuation pattern.Previously, the Savitzky-Golay filter had been used by several previous researchers in digital signal processing using smoothing and differentiation methods which produced clearer and better data [20]- [23].Savitzky-Golay filter can improve data quality by making data in the form of discrete points smoother without distorting the signal trend [24].Several studies have carried out tests using various methods such as the Savitzky-Golay filter, Continuous Wavelet Transform (CWT), Discrete Wavelet Transform (DWT), and α and αβ filters.R. K. Singh, et. al. evaluate the use of the Savitzky-Golay (S-G) filter in minimizing multi-temporal data anomalies in land use mapping, successfully smoothing data and increasing spectral sharpness, increasing land classification accuracy on MODIS Normalized Difference Vegetation Index data (NDVI) [21].Y. Zhang, et.al. use terahertz spectroscopy and the Savitzky-Golay filter algorithm in preprocessing spectral data to efficiently and accurately detect tomato leaf moisture, producing a prediction model with a high level of accuracy [25].J. Zhang, et. al. used Continuous Wavelet Transform CWT to increase the accuracy of detecting chlorophyll content in corn canopies through visible and near-infrared spectrum analysis, with the results showing that CWT can effectively increase the accuracy of chlorophyll detection models in corn plants [26].P. Yadhav et.al. focus on the use of DWT in eliminating noise in multispectral images and improving the performance of deep learning models (VGG19) and Support Vector Machine (SVM) in the classification of E. coli bacterial concentrations, showing that DWT can effectively improve detection accuracy on multi-spectral signals [27].D. O'Kelly, et.al. discuss the application of an online filtration algorithm to Multispectral Optoacoustic Tomography (MSOT) with α and αβ filters, which was shown to be effective in improving the signal-to-noise ratio in MSOT data, enabling better analysis for hypothesis testing in detecting signal changes during oxygen gas challenge [28].The Savitzky-Golay filter method provides advantages in maintaining the continuity and smoothness of multi-spectral signals, so it can detail information better than other methods.The Savitzky-Golay filter's ability to preserve the structure of important features in multi-spectral images makes it a very effective tool for minimizing distortion and improving signal quality, making a significant contribution to the development of superior multi-spectral data processing methods.
To be more specific, the main contributions of this research can be summarized as follows: 1. Propose a new effective method for identifying fluctuation patterns in multi-spectral signals.The use of the Savitzky-Golay filter in the signal processing process has been proven to help reduce noise and produce clearer fluctuation patterns.2. Provides important insights in identifying the characteristics of test materials, especially H2O.By identifying fluctuation patterns in specific segments with high amplitude, material properties can be represented in multi-spectral signal data.
3. The use of this method is not limited to certain areas of the spectrum and has the potential to be applied in a variety of applications that require precise multi-spectral signal analysis.4. Contribute to objective methods in assessing the quality of multi-spectral signals through the use of parameters such as Signal to Noise Ratio (SNR) and Mean Square Error (MSE).

METHODS
The processes carried out during the research are explained at the research stage.These processes can be seen in the following Fig. 1.It can be clearly seen that the flow diagram (Fig. 1) in this study starts from processing High Fluctuation pattern data obtained from previous research [6].The next stage is the segmentation process, followed by the implementation of the SG and no filters.Next, we gain the amplitude for each HF fluctuation pattern value and compare these values.We apply SNR values to both results with and without the SG filter.The last thing to do is analyze the overall results.For more detail, all procedures in this study are explained in the next section.

Data Acquisition
Data acquisition is a system or process that functions to retrieve, collect, and prepare data, and to process it to produce the desired data.A data acquisition system is generally formed in such a way that the system functions well in the process of retrieving, collecting, and storing data in a form that is ready for further processing.
In this study, we use data obtained from acquisition results with the MSCS sensor, the data collection process of which has been carried out in previous research, so this research uses existing data, namely multisectoral data on fluctuation patterns in matrix form [29].At this stage, the data acquisition process resulting from the MSCS process is carried out which converts H2O into voltage and then obtains results with the fluctuation types Mean Fluctuation (MF), High Fluctuation (HF), and High-High Fluctuation (HHF).In this research, what is used is the HF fluctuation pattern, where this pattern shows a more fluctuating state and shows the dominant characteristics of a material [8].
H2O is used because it is a liquid or pure liquid whose content tends to be neutral which can be shown by the Total Dissolved Solid (TDS) value, which is zero which has been tested in the laboratory in previous research [30], TDS is a measure of dissolved substances, both organic and inorganic substances (for example salt, etc.) contained in a solution.The H2O material is used as a platform or foothold in the process of obtaining a spectrum from H2O which is then retrieved and stored by a Digital Storage Oscilloscope (DSO) [6].
MSCS is used to detect changes in a material on a molecular scale.The sensor works based on impedance spectroscopy, so it does not damage the molecules or materials it detects.The main input is a voltage of 26 Vpp, with a frequency that changes between 1 KHz to 1 MHz which can be seen in Table 1.This is because at this frequency it can be predicted that the most dominant noise will occur.However, this noise is the desired noise which can display prominent fluctuations or changes that occur in the material being measured which can show the pattern of the material.
Based on this input, an electric field is generated, where this field causes Coulomb forces experienced by the molecules in the material, thereby causing movement.This movement can produce voltage difference values which are read as fluctuations in the observed values.Data processing is carried out via a Personal Computer (PC) producing a file in .txtformat with a file size of 38 MB.

Method Implementation
As shown in Fig. 2, a programming language is implemented in the form of a MATLAB script for matrix input with a size of 8,192 x 31.The Savitzky-Golay Filter is used to suppress noise that occurs in digital signals in the form of a simulation in MATLAB R2017a software.The parameters that will be seen are the SNR, and MSE values, as well as the graphic display of the signal.

Input Signal
The HF matrix data is first changed from the previous .txtformat to .xlsxformat.So that it can be read in the program, the file format used is mat.The matrix is sized 8,192 x 31, where 31 is the input frequency starting from 1 KHz to 1 MHz, while 8,192 is the spectral number in the matrix which consists of 8,192 points.After that, the signal input can be simulated in a MATLAB script with the command, namely: load ('matriksinput.mat');x = num;

Fig. 3. HF pattern input signal
As shown in Fig. 3 input signals with HF patterns, signals with a different input frequency cannot be seen clearly and are difficult to analyze.On the signal graph, you will see the noise spectral value in units (MHz) against the amplitude in units (V).The color of the graph represents the high amplitude of each segment which is shown by its fluctuation pattern.

Matrix Input Segmentation
The input signal with HF fluctuation patterns is then segmented by dividing by the input frequency using the results in the matrix.The input frequency, namely the frequency used in the data acquisition process, can be seen in Fig. 4. Because the data used is a matrix, data segmentation is carried out based on the columns in the matrix.Segmentation is carried out to be able to see clearly and in detail the significant changes in multispectral signal fluctuation patterns that occur in each segment.In non-stationary signals, changes can occur in the mean and variance values, therefore the signal is broken down into segmentation forms so that it can be analyzed and processed.

Fig. 4. Segmentation model's proposed
Segmentation is very necessary in the pattern recognition process.The better the quality of the segmentation obtained, the better the quality of pattern recognition.For each segment, segmentation is obtained by taking the value from each nth column, namely the 1st column to the 31st column, and taking the value from each mth row, namely the 1st row to the 8th row, 192 then dividing it into many segments.For example, the first segmentation contains values from the 1st column and 1st row to 8,192, and so on.

Simulation of Savitzky-Golay Filter
The simulation will be carried out in several stages, in the MATLAB script the input signal along with the noise signal will be initialized with the code mentioned above.A signal with a matrix size of 8,192 x 31 will be segment-filtered based on the matrix columns, namely 31 segments, which means there are 31 graphs of signals with different frequencies.
In multi-spectral signals there is noise that will interfere with the information from the signal, noise can also change the shape of the original signal, increase or decrease the amplitude, and can even damage the digital signal.So to reduce this, a filter process is carried out using the Savitzky-Golay filter method, which is then useful for obtaining clearer patterns of the test material.
In the filtering simulation using the Savitzky-Golay Filter, there is a block diagram for the process of the Savitzky-Golay Filter method with input in the form of a matrix.With the input signal x(k), namely the H2O dataset which is made into a matrix.The input signal x(k) will be divided into segments based on the matrix columns.The filter will work on these data segments based on the systematic process shown in the block diagram.Then it will produce an output signal y(k) which is expressed mathematically in Eq. (1).
This study uses the Savitzky-Golay Filter tool contained in the MATLAB function with an output signal generated based on Eq. ( 1).The following is the code for filtering the signal.sgf = sgolayfilt(x, order, framelen);  Perform segmentation as many times as the input frequency with the command: x1 = x(:,1); 5.
Display the signal graph resulting from segmentation 1 before filtering.6.
Calculate the SNR value in Segmentation 1 before filtering 7.
Display a graph of the signal segmentation results after filtering 9.
Calculate the SNR value in segmentation 1 after filtering 10.
Calculate the MSE value for segmentation results 1 11.
Repeat steps 4 to 10 for each segmentation per input frequency 12. End

Analysis of Simulation Results
At this stage, an analysis of the results of the MATLAB simulation will be carried out using the Savitzky-Golay filter.After simulating the filter on the signal, it is applied to each signal segmentation and produces a graph, and then the signal graph for each segment is analyzed.On the signal graph, the condition of the prominent fluctuation pattern of the spectral sample relative to the amplitude will be analyzed.The filter will work to suppress the amplitude of the signal and increase the SNR value without losing information on the signal.After the Savitky-Golay filter is applied to the H2O test material data, it then identifies the pattern of H2O based on the fluctuations produced with different frequencies for each segmentation.
Next, look for the SNR value for the signal before filtering and the signal after filtering, then the SNR value will be compared.The greater the SNR value, the better the result is obtained.

Program Implementation
After the simulation program is implemented and can be run, the MATLAB simulation results are obtained, namely in the form of a graph of a multi-spectral signal or a signal with multiple frequencies, namely 31 frequencies segmented by frequency and the signal graph before filtering and the signal graph after filtering are displayed, as well as the SNR value before and after filtering, and MSE value.

HF Pattern Signal Segmentation Results
Fig. 5 shows the amplitude comparison values, considering the highest amplitude of the HF segmentation results.This value is taken for all generated spectral.Furthermore, to further clarify, the results of the segmentation values, which have the highest amplitude values in the top 20 rankings, are shown in Table 3. Significantly, the value in the 10th segmentation offers the highest value with an amplitude value of 192 and the smallest amplitude value in the 19th segmentation with an amplitude value of 98.

Data Analysis Based on Segmentation Results of HF Fluctuation Patterns
the HF fluctuation pattern that shows a more fluctuating state and shows the dominant characteristics of the test material.After carrying out the segmentation process, it is continued with a filtering process which aims to reduce noise by smoothing the HF fluctuation pattern to get the best H2O pattern, so that the characteristics of the pure water pattern are known.In the signal graph before filtering, there are fluctuations caused by noise that interfere with the data.Before the signal is filtered, the signal amplitude has a larger value compared to the signal after filtering which has a small amplitude value because the filter has suppressed noise in the signal, or the Savitzky method is called signal smoothing.
Table 4 shows the order of the top 10 highest amplitude fluctuations in HF pattern types with several parameters, such as rank order, number of segments, input frequency, spectral, and highest amplitude.From the segmentation results, it is known that the characteristics of pure water in each segment have high amplitude.As seen in Table 3 the highest amplitude is in segment 20 followed by segment 1, segment 2, and so on as in the table, with peak amplitude sequence values between 186V to 265V.

Signal Quality Analysis Based on SNR and MSE
The quality of the multi-spectral signal fluctuation pattern is based on the SNR value and MSE value produced for each segment, which is as follows: 1. Signal-to-Noise Ratio: The signal to Noise Ratio (SNR) calculation is carried out to determine the amount of noise that affects the signal.The results obtained will become the reference SNR for the filter.This process aims to ensure that the filtering process is carried out as desired and that the suppression of noise affecting the signal works well.In Fig. 6, the SNR value of each signal segment before and after the filter process.The greater the SNR value produced, the better the signal quality, so that information from the test material can be identified.The MSCS sensor proved effective as a movement detection tool in the H2O test material, with the results reflected in the signal fluctuation pattern.Segmentation of fluctuation patterns in the HF frequency range has proven successful, facilitating pattern recognition even with varying input frequencies.Furthermore, the use of the Savitzky-Golay adaptive filter was also proven to be optimal in reducing noise and smoothing multispectral signal fluctuation patterns.
In addition, through segmentation, H2O characteristics can be identified in each segment with dominant fluctuations, characterized by peak amplitudes ranging from 186V to 265V.Finally, objective assessment of multi-spectral signal quality using the SNR value shows variations, with the largest SNR reaching 16.6146 dB in the 17th segmentation, and the lowest SNR of 3.0171 dB in the 26th segmentation.In addition, the average MSE value of 31.94 provides further insight into the quality of the observed signal.These conclusions strengthen the results of this study and provide valuable insights into a deeper understanding of movement detection in H2O test materials through analysis of signal fluctuation patterns.
Several suggestions for future work can be continued from this study.First, Add another solution to H2O to compare the fluctuation patterns and characteristics of the added test material.Another thing is to use another adaptive filter to compare filter performance.

Fig. 5 .
Fig. 5.The highest amplitude of the HF segmentation results

Fig. 6 .
Fig. 6.SNR values before and after filtering 2. Mean Square Error: The Mean Square Error (MSE) calculation is carried out to determine the average square error value between the original signal and the filtered signal.In Fig. 7, the MSE value of each segment of the HF fluctuation pattern.

Fig. 7 .
Fig. 7. MSE value for each segmentation 4. CONCLUSIONThe MSCS sensor proved effective as a movement detection tool in the H2O test material, with the results reflected in the signal fluctuation pattern.Segmentation of fluctuation patterns in the HF frequency range has proven successful, facilitating pattern recognition even with varying input frequencies.Furthermore, the use of the Savitzky-Golay adaptive filter was also proven to be optimal in reducing noise and smoothing multispectral signal fluctuation patterns.In addition, through segmentation, H2O characteristics can be identified in each segment with dominant fluctuations, characterized by peak amplitudes ranging from 186V to 265V.Finally, objective assessment of multi-spectral signal quality using the SNR value shows variations, with the largest SNR reaching 16.6146 dB in the 17th segmentation, and the lowest SNR of 3.0171 dB in the 26th segmentation.In addition, the average MSE value of 31.94 provides further insight into the quality of the observed signal.These conclusions strengthen the results of this study and provide valuable insights into a deeper understanding of movement detection in H2O test materials through analysis of signal fluctuation patterns.Several suggestions for future work can be continued from this study.First, Add another solution to H2O to compare the fluctuation patterns and characteristics of the added test material.Another thing is to use another adaptive filter to compare filter performance.

Table 2
is a pseudocode algorithm from the program simulation process in MATLAB, as follow:

Table 1 .
Signal processing stages using the Savitzky-Golay Filter

Table 3 .
Comparison with Previous Top 20 Segmentation

Table 4 .
Comparison with Previous Top 10 Segmentation