## 4 Case Study of Cardio-Vascular Disease Using Fuzzy Logic
### Heart Disease Diagnosis  
In this case study, there were eight inputs and one output.  
* **Cholesterol.** This input variable has four linguistic variables: normal, medium, high, and very high. The normal and very high values were represented in trapezoidal membership functions, while the others (medium and high) were represented in  
Figure 1: Graphical representation of the expert system.  
triangular membership functions. The range for cholesterol was taken as [0-500], as represented in Figure 2.  
* **Body mass index (BMI).** This input variable had four membership functions, which were \"underweight range (UR)\", \"healthy range (HR)\", \"overweight range (OWR)\", and \"obese range (OR)\", shown in Figure 3.
* **Age.** The input linguistic variables were divided into four parts, 'young','medium,' 'old', and'very old', as depicted in Figure 4.
* **Blood pressure (BP).** Blood pressure was divided into three categories: normal, medium, and high. The range for blood pressure was [0 200]. The normal and high linguistic variables used trapezoidal membership functions, as shown in Figure 5.  
Figure 4: Membership function of age.  
Figure 3: Membership function of body mass index.  
Figure 2: Membership function of cholesterol.  
* **Physical activity.*
* This input field had two values: 0 (false) and 1 (true). If the patient exercises regularly, then value = 1; otherwise, value = 0, as shown in Figure 9.
* **Output variable**. To predict the risk level of cardiovascular disease, the output variables were of three types, healthy, early stage, and advanced stage, as shown in Figure 10.
* **Fuzzy rule-based**. The next step was to enter the rules into the system. The rule was then inserted using a rule-based system. This is the main component of a fuzzy interface system. The output of the expert system is dependent on what is inserted into it, and 40 rules were inserted for the risk level of cardiovascular disease [70; 71; 72; 73]. The rules are as follows:
* If (Age is Y) and (BMI is UR) and (Cholesterol is N) and (Blood Pressure is Normal) and (Smoker is True) and (Diabetes is Normal) and (Physical Activity is True) and (Gender is M), then (Disease classification is Healthy) (1)  
Figure 8: Membership function for smoker.  
Figure 10: Output variable disease classification.  
Figure 9: Membership function for physical activity.  
If (Age is Medium) and (BMI is UR) and (Cholesterol is Normal) and (Blood Pressure is Normal) and (Smoker is True) and (Diabetes is Normal) and (Physical Activity is True) and (Gender is Male), then (Disease classification is Healthy) (1). -If (Age is Young) and (BMI is HR) and (Cholesterol is Medium) and (Blood_Pressure is Medium) and (Diabetes is Normal) and (Physical Activity is True) and (Gender is Male), then (Disease classification is Healthy) (1) -If (Age is Medium) and (BMI is HR) and (Cholesterol is High) and (Blood Pressure is High) and (Smoker is True) and (Diabetes is Diabetic) and (Gender is Male), then (Disease classification is Early Stage) (1) -If (Age is Very Old) and (BMI is OR) and (Cholesterol is Very High) and (Blood_Pressure is High) and (Diabetes is Normal) and (Physical Activity is True) and (Gender is Male), then (Disease classification is Advanced Stage) (1)