# Inertial and Flexible Resistive Sensor Data Fusion for Wearable Breath Recognition
## 6 Identifying the Breath Type  
The Short-Time Fourier Transform (STFT) is used to analyze and understand the temporal frequency characteristics of a signal. In the realm of breathing analysis, the STFT has emerged as a valuable resource. The procedure is initiated by segmenting the respiratory data into brief time intervals, with each window depicting a small segment of the total signal duration. The rationale behind selecting these short time intervals is to capture the dynamic variations in the breathing pattern as it evolves over time. Upon segmenting the signal, the Fast Fourier Transform (FFT) is applied to each window individually. This process allows insights to be gained regarding the evolution of the frequency content of the breathing signal over time. To avoid overlooking vital information, overlapping windows are employed. This approach ensures comprehensive coverage of the entire signal duration, accurately capturing the nuances and variations in the breathing pattern. In the context of determining breathing types, the STFT facilitates a thorough exploration of frequency variations over short intervals. This method enables the identification of specific patterns or characteristics associated with different breathing types. This comprehensive analysis serves to differentiate between various breathing patterns and enhances the overall accuracy of breath monitoring systems. To assess how the developed approach can identify the type of breathing, a test involving deep, normal, and shallow breathing was considered. After the developed fusion technique is applied and nonrespiratory information is filtered from the flex sensor data depicted in Figure 11, the signal is segmented into 6 s time intervals with a 3 s overlap. Subsequently, the FFT is applied to each time interval to extract information concerning the frequencies present within that interval. Figure 10: (**a**) Flex sensor data before and after filtering, (**b**) spirometer data of the deep breathing test in the presence of body motion showing the filtered flex sensor waveform follows that of the ground truth (spirometer). Breath cycles are shown in highlighted (yellow) numbers. Figure 12 displays the STFTs of the experimental tests and reveals the dominant frequencies within each time interval. The most dominant frequency in each interval corresponds to the maximum magnitude of the FFT within that interval. By determining thresholds as conditions for switching between breath types and utilizing the dominant frequency in each time window, breath types can be classified. To determine distinct thresholds for breath type identification, experimental tests were conducted. Each participant was instructed to perform deep, normal, and shallow breathing. Figure 13 illustrates the ranges of dominant frequencies observed during these tests. Based on the results, the threshold between the two types of breathing was calculated by averaging the mean frequency of each breathing type. Based on Figure 12, the most dominant frequency of the experimental test within each time interval is shown in Figure 14. Using defined thresholds, it is possible to determine the types of breathing present in the test and determine the duration of each type of breathing. Based on the classification results, the number of breath cycles for each type can be determined. Table 1 shows the comparison and validation of our sensor system when compared against the gold-standard spirometer data. The table compares these results with the actual number of breath cycles captured by the spirometer when the participant performed various breathing exercises and data were captured by using both the spirometer and the proposed wearable sensor. The breathing signal data from the spirometer is considered the gold standard data and ground truth. By comparing the performance of the wearable sensor against the gold standard, it ensures the sensing system's validation and its accuracy and reliability in measuring respiratory parameters.