Advertisement
adwas33

Untitled

Dec 6th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. % Utworzenie nowego systemu rozmytego
  2. fis = mamfis('Name', 'Sygnał do kupna');
  3.  
  4. % Dodawanie zmiennych wejściowych
  5. fis = addInput(fis, [0 100], 'Name', 'FearAndGreed');
  6. fis = addInput(fis, [0 100], 'Name', 'RSI');
  7.  
  8. % Dodawanie zmiennej wyjściowej
  9. fis = addOutput(fis, [0 100], 'Name', 'BuySignal');
  10.  
  11. % Dodawanie funkcji przynależności dla Fear and Greed
  12. fis = addMF(fis, 'FearAndGreed', 'trapmf', [0 0 15 30], 'Name', 'very_low');
  13. fis = addMF(fis, 'FearAndGreed', 'trapmf', [15 30 45 60], 'Name', 'low');
  14. fis = addMF(fis, 'FearAndGreed', 'trapmf', [45 60 75 90], 'Name', 'medium');
  15. fis = addMF(fis, 'FearAndGreed', 'trapmf', [75 90 105 120], 'Name', 'high');
  16. fis = addMF(fis, 'FearAndGreed', 'trapmf', [105 120 135 150], 'Name', 'very_high');
  17.  
  18. % Dodawanie funkcji przynależności dla RSI
  19. fis = addMF(fis, 'RSI', 'trapmf', [0 0 10 20], 'Name', 'very_low');
  20. fis = addMF(fis, 'RSI', 'trapmf', [10 20 30 40], 'Name', 'low');
  21. fis = addMF(fis, 'RSI', 'trapmf', [30 40 50 60], 'Name', 'medium');
  22. fis = addMF(fis, 'RSI', 'trapmf', [50 60 70 80], 'Name', 'high');
  23. fis = addMF(fis, 'RSI', 'trapmf', [70 80 90 100], 'Name', 'very_high');
  24.  
  25. % Dodawanie funkcji przynależności dla BuyDecision
  26. fis = addMF(fis, 'BuySignal', 'trimf', [0 25 50], 'Name', 'very_low');
  27. fis = addMF(fis, 'BuySignal', 'trimf', [25 50 75], 'Name', 'low');
  28. fis = addMF(fis, 'BuySignal', 'trimf', [50 75 100], 'Name', 'medium');
  29. fis = addMF(fis, 'BuySignal', 'trimf', [75 100 125], 'Name', 'high');
  30. fis = addMF(fis, 'BuySignal', 'trimf', [100 125 150], 'Name', 'very_high');
  31.  
  32. %fis = addRule(fis,'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)');
  33.  
  34. %
  35. % Dodawanie reguł
  36. rules = {
  37. 'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)'
  38. 'If FearAndGreed is very_low and RSI is low then BuySignal is high (1)'
  39. 'If FearAndGreed is very_low and RSI is medium then BuySignal is medium (1)'
  40. 'If FearAndGreed is very_low and RSI is high then BuySignal is low (1)'
  41. 'If FearAndGreed is very_low and RSI is very_high then BuySignal is very_low (1)'
  42.  
  43. 'If FearAndGreed is low and RSI is very_low then BuySignal is very_high (1)'
  44. 'If FearAndGreed is low and RSI is low then BuySignal is high (1)'
  45. 'If FearAndGreed is low and RSI is medium then BuySignal is medium (1)'
  46. 'If FearAndGreed is low and RSI is high then BuySignal is low (1)'
  47. 'If FearAndGreed is low and RSI is very_high then BuySignal is very_low (1)'
  48.  
  49. 'If FearAndGreed is medium and RSI is very_low then BuySignal is high (1)'
  50. 'If FearAndGreed is medium and RSI is low then BuySignal is medium (1)'
  51. 'If FearAndGreed is medium and RSI is medium then BuySignal is medium (1)'
  52. 'If FearAndGreed is medium and RSI is high then BuySignal is medium (1)'
  53. 'If FearAndGreed is medium and RSI is very_high then BuySignal is low (1)'
  54.  
  55. 'If FearAndGreed is high and RSI is very_low then BuySignal is medium (1)'
  56. 'If FearAndGreed is high and RSI is low then BuySignal is medium (1)'
  57. 'If FearAndGreed is high and RSI is medium then BuySignal is low (1)'
  58. 'If FearAndGreed is high and RSI is high then BuySignal is very_low (1)'
  59. 'If FearAndGreed is high and RSI is very_high then BuySignal is very_low (1)'
  60.  
  61. 'If FearAndGreed is very_high and RSI is very_low then BuySignal is low (1)'
  62. 'If FearAndGreed is very_high and RSI is low then BuySignal is very_low (1)'
  63. 'If FearAndGreed is very_high and RSI is medium then BuySignal is very_low (1)'
  64. 'If FearAndGreed is very_high and RSI is high then BuySignal is very_low (1)'
  65. 'If FearAndGreed is very_high and RSI is very_high then BuySignal is very_low (1)'
  66. };
  67. fis = addRule(fis, 'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)');
  68. fis = addRule(fis, 'If FearAndGreed is very_low and RSI is low then BuySignal is high (1)');
  69. fis = addRule(fis, 'If FearAndGreed is very_low and RSI is medium then BuySignal is medium (1)');
  70. fis = addRule(fis, 'If FearAndGreed is very_low and RSI is high then BuySignal is low (1)');
  71. fis = addRule(fis, 'If FearAndGreed is very_low and RSI is very_high then BuySignal is very_low (1)');
  72.  
  73. fis = addRule(fis, 'If FearAndGreed is low and RSI is very_low then BuySignal is very_high (1)');
  74. fis = addRule(fis, 'If FearAndGreed is low and RSI is low then BuySignal is high (1)');
  75. fis = addRule(fis, 'If FearAndGreed is low and RSI is medium then BuySignal is medium (1)');
  76. fis = addRule(fis, 'If FearAndGreed is low and RSI is high then BuySignal is low (1)');
  77. fis = addRule(fis, 'If FearAndGreed is low and RSI is very_high then BuySignal is very_low (1)');
  78.  
  79. fis = addRule(fis, 'If FearAndGreed is medium and RSI is very_low then BuySignal is high (1)');
  80. fis = addRule(fis, 'If FearAndGreed is medium and RSI is low then BuySignal is medium (1)');
  81. fis = addRule(fis, 'If FearAndGreed is medium and RSI is medium then BuySignal is medium (1)');
  82. fis = addRule(fis, 'If FearAndGreed is medium and RSI is high then BuySignal is medium (1)');
  83. fis = addRule(fis, 'If FearAndGreed is medium and RSI is very_high then BuySignal is low (1)');
  84.  
  85. fis = addRule(fis, 'If FearAndGreed is high and RSI is very_low then BuySignal is medium (1)');
  86. fis = addRule(fis, 'If FearAndGreed is high and RSI is low then BuySignal is medium (1)');
  87. fis = addRule(fis, 'If FearAndGreed is high and RSI is medium then BuySignal is low (1)');
  88. fis = addRule(fis, 'If FearAndGreed is high and RSI is high then BuySignal is very_low (1)');
  89. fis = addRule(fis, 'If FearAndGreed is high and RSI is very_high then BuySignal is very_low (1)');
  90.  
  91. fis = addRule(fis, 'If FearAndGreed is very_high and RSI is very_low then BuySignal is low (1)');
  92. fis = addRule(fis, 'If FearAndGreed is very_high and RSI is low then BuySignal is very_low (1)');
  93. fis = addRule(fis, 'If FearAndGreed is very_high and RSI is medium then BuySignal is very_low (1)');
  94. fis = addRule(fis, 'If FearAndGreed is very_high and RSI is high then BuySignal is very_low (1)');
  95. fis = addRule(fis, 'If FearAndGreed is very_high and RSI is very_high then BuySignal is very_low (1)');
  96.  
  97.  
  98. % Wyświetlanie konfiguracji systemu
  99. fis
  100.  
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement