# Fuzzy inference systems

### ACKNOWLEDGEMENT

I would firstly like to thank Dr. Ramchandran (Director BPD) for giving me this opportunity to prepare and present this project. I would also like to thank Dr. D.V. Prasad , for his encouragement. The special thank goes to my helpful supervisor, Ms Swarnalatha. The supervision and support that she gave truly help the progression and smoothness of the Project. The co-operation is much indeed appreciated. I would also like to thank all the faculty of EIE Branch (BPD) for their support and assistance offered at the requested times.

### CHAPTER 1- INTRODUCTION

Fetal heart rate extraction from the abdominal ECG is of great importance due to the information that it carries in assessing appropriately the fetus well-being during pregnancy. Fuzzy inference systems incorporate human knowledge and perform inferencing and decision making. Noise is an unwanted energy, which interferes with the desired signal. It can be suppressed with adaptive filters using signal processing. But if the noise frequency is same as the original signal then sometimes it also eliminates the desired signal. Therefore, noise cancellation is used which will not affect the desired signal.

Signal processing problems related to abdominal-lead fetal ECG include the cancellation of the maternal QRS complex, signal enhancement of the fetal QRS complex and detection of the presence of a fetal R-wave to compute the fetal heart rate. The fuzzy detector incorporates a measure of uncertainty and can conclude that a maternal and fetal ECG is present in the maternal abdominal recordings.

Fetal heart rate monitoring is a technique for obtaining important information about the condition of a fetus during pregnancy and labor, by detecting the FECG signal that is generated .

The ultimate reason for the interest in FECG signal analysis is in clinical diagnosis and biomedical applications. The extraction and detection of the FECG signal from composite abdominal signals with powerful and advance methodologies is becoming a very important requirement in fetal monitoring.

Fetal ECG (FECG) monitoring enables accurate measurement of fetal cardiac performance including transient or permanent abnormalities of rhythm .Sometimes the FECG is the only information source in early stage diagnostic of fetal health.

1

### CHAPTER 2 - FUZZY LOGIC THEORY

Fuzzy logic is a logical system, which is an extension of multivalued logic. It is almost synonymous with the theory of fuzzy sets, a theory that relates to classes of objects with unsharp boundaries in which membership is a matter of degree.

### 2.1 Advantages of fuzzy logic

- Fuzzy logic is conceptually easy to understand.
- It is flexible.
- Tolerant to imprecise data.
- It can model nonlinear functions of arbitrary complexity.
- It can be built on top of the experience of experts.
- It can be blended with conventional control techniques.
- It is based on natural language.
- Faster and cheaper.

Fuzzy logic is mainly used with imprecision and non linearity.

### 2.2 Basic concepts in fuzzy logic

There are two basic concepts in fuzzy logic. They are linguistic variable and fuzzy if-then rule or fuzzy rule.

* Linguistic variable*

It is a variable whose values are words rather than numbers. Its use is closer to the tolerance for imprecision and thereby lowers the cost of solution. It encapsulates the properties of approximate or imprecise concepts in a systematic and computationally useful way. It also reduces the apparent complexity of describing a system.

2

* Fuzzy IF- THEN rule*

IF -THEN rule statements are used to formulate the conditional statements that comprise fuzzy logic. A single IF - THEN rule assumes the form if x is A then y is B where A and B are linguistic values defined by fuzzy sets on the ranges (universe of discourse) X and Y, respectively. The **IF **part of the rule "x is A" is called the *antecedent or premise*, while the **THEN **part of the rule "y is B" is called the *consequent or conclusion*. [1]

### 2.3 Membership functions

A fuzzy set is completely characterized by its membership function. A membership function is a curve that defines how each point in the input space is mapped to a membership value (or degree of membership) between 0 and 1.The input space is

sometimes referred to as the universe of discourse. The generalized bell membership function is specified by three parameters and has the function name **gbellmf. **The bell membership function has one more parameter than the Gaussian membership

function, so it can approach a non-fuzzy set if the free parameters tuned .

*bell(x;a,b,c)=1/[1+(x-c)/a]^2b*

A desired generalized bell membership function can be obtained by a proper selection of the parameter set {a,b,c}. Specifically, we can adjust c and a to vary the central width of the MF, and then use b to control the slopes at the crossover points. Because of their smoothness and concise notation,Gaussian and bell MFs are becoming increasingly

popular for specifying the fuzzy sets. Gaussian functions are well known in probability and statistics, and they possess useful properties such as invariance under multiplication (the product of two Gaussians is a Gaussian with a scaling factor) and Fourier transform (the Fourier transform of a Gaussian is Gaussian). Although the Gaussian MFs and bell MFs achieve smoothness, they are unable to specify asymmetric MFs, which are important in certain applications. Asymmetric and close MFs can be synthesized using either the absolute difference or the product of two sigmoidal functions.

### Fuzzy sets describe vague concepts.

The degree an object belongs to a fuzzy set is denoted by a membership value between 0 and 1. A membership associated with a given fuzzy set maps an input to its appropriate membership value.

### 2.4 Fuzzy inference systems

Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. The mapping then provides a basis from which decisions can be made, or patterns discerned an input value to its appropriate membership value.

* Types of FIS*

(1) Mamdani-type

(2) Sugeno-type [2]

### CHAPTER 3- TECHNIQUES USED FOR SUPPRESSION OF MATERNAL ECG COMPONENT

Monitoring the fetal heart rate (FHR) and fetal electrocardiogram (FECG) during pregnancy is important to support medical decision making. Before labor, the FHR is usually monitored using Doppler ultrasound. This method is inaccurate and therefore of limited clinical value. During labor, the FHR can be monitored more accurately using an invasive electrode; this method also enables monitoring of the FECG. Antenatally, the FECG and FHR can also be monitored using electrodes on the maternal abdomen. The signal-to-noise ratio of these recordings is, however, low, the maternal electrocardiogram (MECG) being the main interference. Existing techniques to remove the MECG from these non-invasive recordings are insufficiently accurate or do not provide all spatial information of the FECG.

**1)** Here, a new technique for MECG removal in antenatal abdominal recordings is presented. This technique operates by the linear prediction of each separate wave in the MECG. Its performance in MECG removal and FHR detection is evaluated by comparison with spatial filtering, adaptive filtering, template subtraction and independent component analysis techniques. The new technique outperforms the other techniques in both MECG removal and FHR detection (by more than 3%).

**2)** MECG suppression has also been accomplished by a **subtraction technique** where the maternal complex in the abdominal recording is suppressed by the subtraction of

another similar complex. This second MECG complex may either be simultaneously recorded elsewhere on the mother or a previous pure MECG complex in the same

abdominal recording . However, the success of both techniques is very dependent on the matching of the two complexes, which cannot be guaranteed in most cases.

**3) **A better method uses an **averaging technique** whereby the MECG template for the subtraction is formed from a running average of previously detected MECG complexes in the abdominal signal. Such an averaging process suppresses the fetal and noise contribution to the template while guaranteeing some adaptation of the template to varying waveforms of the MECG. Amplitude variations of the MECG, however, require the scaling of the average template to the actual MECG amplitude before subtraction. If a single abdominal lead is used then separation of the maternal signal must rely on the use of some form of amplitude and/or frequency discrimination.[3]

### CHAPTER 4 : ENHANCEMENT OF THE FETAL COMPLEX

The fetal complexes have been successfully enhanced by **matched filtering technique** . This involves firstly cross-correlating the abdominal signal with the MECG template to enhance the MECG detection. Taking a few significant points on the QRS template alleviates its time consuming process . Following MECG suppression, the fetal QRS complexes in the subtracted signal are enhanced by another cross-correlation routine.

The performance of such algorithms can be further improved with the incorporation of multiple features such as cross-correlation, RS height, pulse-duration and RR interval calculation. By processing several features, it is less likely that large amplitude but short duration noise would be mistaken for a QRS complex. Similarly, it is more likely that a true QRS complex with low amplitude, but normal width and RR interval would be

correctly detected. Fuzzy inference systems are well suited for this application , because they provide a convenient framework for using expert knowledge to approximate complex nonlinear systems.[4]

### CHAPTER 5: DETECTION ALGORITHM

A QRS detection algorithm, which uses a fuzzy decision method to identify maternal and fetal ECG from single lead maternal abdominal recordings, is developed. Two sets of fuzzy rule base are used for the detection by utilizing the basic characteristics of the ECG. Fuzzy decision is applied to the output of the matched filter and the RS coefficient, which is the peak-to-peak ratio between the composite and the template signal.

This algorithm also extracts the fetal signal from the composite signal by subtracting the maternal signal at appropriate time junctures by using an auto-correlation calculation to scale the template before subtracting. The main program consists of the initialization

procedures and within the loop, procedures to search for the maternal R-wave, average and subtract the maternal template. During each sampling interval within these procedures, the receive data, cross-correlation and RS height search routines are performed. The initialization procedure to detect the fetal signal commences after the

subtraction of the first maternal complex. The crosscorrelation and RS height search routines for the fetal signals are also performed during each sampling interval.

An algorithm for separating the fetal and maternal ECG signals obtained from intrauterine electrodes during labour and also from the abdominal electrodes. The

algorithm detects all occurrences of ECG complexes and uses linear regression functions to compare each complex with a set templates. Sets of templates are identified as either maternal or fetal in origin and two signals are output for heart rate measurement. The outputs are also processed to eliminate artefacts that may occur when the maternal and fetal complexes are coincident. The algorithm processes 10 seconds of data at a time (in about 200 ms on a standard PC) while a further 10 s of data is being acquired. [5]

### 5.1 METHODS USED FOR THE DETECTION ALGORITHM

Signals are said to be correlated if the shapes of the waveforms of the two signals match one another. The correlation co-efficient is a value that determines the degree of match between the shapes of two or more signals. A QRS detection technique uses cross

correlation. This technique of correlating one signal with another requires that the two signals be aligned with one another and is called **cross correlation**. In QRS detection technique, a digitized form of the signal shape is stored for the template of the signal that is to be matched. Since the template has to be correlated with the incoming signal, the signal should be aligned with the template.

**1)** The first method of aligning the template and the incoming signal is by using the fiducial points on each signal. These fiducial points have to be assigned to the signal by some external process. If the fiducial points on the template and the signals are aligned, then the correlation can be performed.

**2)** Another implementation involves continuous correlation between a segment of the incoming signal and the template.

Whenever new signal data point arrives, the oldest data point in time is discarded from the segment (a first-in-first-out data structure). A correlation is performed between this signal segment and the template segment that has the same number of signal points. This technique does not require processing time to assign fiducial points to the signal. The template can be thought as a window that moves over the incoming signal one data point at a time. The second technique was followed in the algorithm.

The value of the cross correlation co-efficient always falls between *+1 *and *-1*. A value of *+1 *indicates that the signal and the template match exactly. The value of the coefficient determines how well the shapes of the waveforms under consideration match

recognizing process of QRS complexes conforms with our natural approach to recognizing signals.

The subtraction of the template from the whole complex is a very critical procedure since any slight shift in the subtracting template will produce residuals that obscure the fetal complex and may cause serious difficulties in FECG detecting. Though the subtraction operation is done while carefully fine aligning the peaks and subtracting the template from the coming complex. Two samples of the MECG template are averaged and subtracted within each sampling interval.

This algorithm identifies the presence of the maternal QRS complex in the composite signal by using a fuzzy decision method incorporating two fuzzified inputs. The inputs include a correlation co-efficient that uses an ever-changing template derived from the average of the present template and the signal last-compared, and also include the RS co-efficient which is the ratio between the present and the last peak-to-peak RS signal height. A fuzzy decision method is also used to detect the remaining fetal signal after subtraction, by incorporating similar fuzzified inputs as above.[5]

### CHAPTER 6: NOISE CANCELLATION

Noise combating presents one of the most challenging problems in Signal Processing basically due to the fact that a signal can pick upnoise and be distorted such that the information carried by the signal can be misinterpreted. Thus, it is important that the impairments due to noise be reduced or eliminated totally from signals in almost all signal processing and communications tasks. There are two broad classes of methods to eliminate noise from a signal.

**1)** The first method is by filtering noise from the signal. This removes noise from the signal by supressing certain frequencies. However, in the process, it also removes a part of the signal, which may be an important part of the signal processing application.

**2)** The second method is noise cancellation. In this method, an estimate of the noise in the system is obtained. The system will then try to eliminate the noise by subtracting the estimate from the signal. This means that no part of the original signal is removed. This method effectively removes noise even if the noise has the same frequencies as the signal. Due to the random nature of noise, it is difficult to obtain an exact representation of the noise signal thus the efficiency of a noise cancellation system depends very much on the accuracy of the estimated noise signal. Performance of the system is improved by using an adaptive noise cancellation technique(neuro fuzzy logic), which would adjust the system characteristics in order to produce a better noise estimate.

**3) **An approach based on adaptive noise cancellation (ANC) is evaluated for extraction of the fetal heart rate using photoplethysmographic signals from the maternal abdomen. A simple optical model is proposed in which the maternal and fetal blood pulsations result in emulated signals where the lower SNR limit (fetal to maternal) is -25dB. It is shown that a recursive least-squares algorithm is capable of extracting the peaks of the fetal PPG from these signals, for typical values of maternal and fetal tissues.[6]

### CHAPTER 7: RESULT OF THE DETECTION ALGORITHM

Performance of the algorithm was tested using several recorded maternal ECG signals recorded by ambulatory recorder using three skin electrodes. Results were obtained from ECG recordings with 500 Hz sampling rate for gestational ages between 31 and 41 weeks.

The figure 1 below presents signals at various steps of the algorithm operation obtained from an abdominal recording of a pregnant woman at 39 weeks.It shows the output of the notch filter containing maternal and fetal QRS complexes. Further it shows the remaining fetal signals after detection and subtraction of maternal QRS complexes and then it shows the final output stream of pulses marking the locations of the fetal QRS complexes.

Various steps of the algorithm operation obtained from an abdominal recording [7]

(a) Abdominal signal

(b) Fetal signal after maternal extraction

(c) Detected fetal pulse stream

12

### CHAPTER 8: INTRODUCTION TO MATLAB

Matlab is an advanced interactive software package designed specially designed for scientific and engineering computation . It is a high performance language for technical computation, visualization and programming in an easy to use environment where problems and solutions are expressed in familiar mathematical notation.

The **RUN** command for fuzzy in MATLAB is: **fuzzy(fismat)**

### 9.1 Matlab Fuzzy Toolbox consist of useful Tools:

### 1) FIS Editor:

This Editor in combination with 4 other editors provides a powerful environment to define and modify Fuzzy Inference System (FIS) variable.

### 2) Fuzzy Controller:

This is a block in Fuzzy Toolbox Library in Simulink environment. This Block admits FIS variable produced by FIS Editor and implements the desirable rules.

### 9.2 FIS Diagram

To implement a Fuzzy Inference System, five steps must be followed :

1. Fuzzification using input membership functions

2. Apply Fuzzy Operand

3. Apply Implication method on each rule

4. Aggregate all Outputs

5. Defuzzification of output

### 9.3 FIS Editor

Change or modify inference settings,add or remove membership functions to or from any input or output and also set membership parameters manually.

### Input or Output

### Double Click

When you know Input/Output relationship clearly, FIS Editor and 4 other editors help you to implement your knowledge, using simulink Fuzzy controller block.

If you just know some distinct Input/Output points, ANFIS Editor helps you to train your Membership functions' parameters to adjust all desired points.[8]

### CHAPTER 9: CONCLUSION

An algorithm for detecting the maternal and fetal QRS complexes has been presented. Initial results showed that detections were successful in most cases except noisy spells. Further work is being carried out to improve the performance of the algorithm in such situation. The algorithm is finally expected to perform satisfactorily on abdominal signal from pregnant women in ambulation.

The algorithm here is a QRS detection algorithm. Reliable detection is achieved except at very noisy instances. Further improvement is expected with refinement of the algorithm and its features. Promising results have been obtained by tuning the fuzzy

membership functions.

FECG (Fetal ECG) signal contains potentially precise information that could assist clinicians in making more appropriate and timely decisions during pregnancy and labour. The extraction and detection of the FECG signal from composite abdominal signals with powerful and advance methodologies is becoming a very important requirement in fetal monitoring.

### FUTURE WORK

The MATLAB syntax would be applied to write programs in order to obtain the final output stream of pulses marking the locations of the fetal QRS complexes. Furthermore, extraction of the FECG would be done using the detection algorithm and fuzzy decision method incorporating fuzzified inputs. Use of techniques like adaptive noise cancellation to remove the noise interference and further application of MATLAB tools to enhance the output.

### REFERENCES

[1] Timothy J.Ross, "Fuzzy logic with Engineering Applications",McGRAW-Hill International Inc,1997.

[2] J.S.R.Jang, C.T.Sun and E.mizuatani, "Neuro-Fuzzy and Softcomputing", Prentice Hall International Inc ., 1997.

[3] Y. Tal, S. Akselrod, "Fetal Heart Rate Detection By A Special Transformation Method", *IEEE Comp. Soc. Conf. Proc., Computers in Cardiology*, 1990, pp. 275-278.

[4] S. Azevedo and R. L. Longini, "Abdominal-lead fetal electro-cardiographic R-wave enhancement for heart rate determination", *IEEE Trans. Biomed. Eng*., vol. 27, pp. 255-260, 1990.

[5] Fetal electrocardiogram extraction-Elsevier

[6] Extraction of fetal ECG via adaptive noise cancellation approach

[7] IEEE 2.0-Fetal QRS complex detection using a fuzzy approach

### Websites

**[8] **www.mathsworks.com

**[9]**www.ieeexplore.ieee.org