Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int FuzzyLogic(double x)
- {
- double y1;
- double y2;
- if(x<=0.9)
- {
- return 1;
- }
- else
- {
- if ((x > 0.9) && (x < 1.1))
- {
- y1 = -6.66 * x + 7;
- y2 = 6.66 * x - 6.33;
- if (y1 > y2)
- {
- return 1;
- }
- else
- {
- return 2;
- }
- }
- else
- {
- if (x == 1.1)
- {
- return 2;
- }
- else
- {
- if ((x > 1.1) && (x < 1.5))
- {
- y1 = -6.66 * x + 8.33;
- y2 = 2.85 * x - 3.28;
- if (y1 > y2)
- {
- return 2;
- }
- else
- {
- return 3;
- }
- }
- else
- {
- if (x >= 1.5)
- {
- return 3;
- }
- else
- {
- return 0;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement