Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Utworzenie nowego systemu rozmytego
- fis = mamfis('Name', 'Sygnał do kupna');
- % Dodawanie zmiennych wejściowych
- fis = addInput(fis, [0 100], 'Name', 'FearAndGreed');
- fis = addInput(fis, [0 100], 'Name', 'RSI');
- % Dodawanie zmiennej wyjściowej
- fis = addOutput(fis, [0 100], 'Name', 'BuyDecision');
- % Dodawanie funkcji przynależności dla Fear and Greed
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [0 0 15 30], 'Name', 'VeryLow');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [15 30 45 60], 'Name', 'Low');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [45 60 75 90], 'Name', 'Medium');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [75 90 105 120], 'Name', 'High');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [105 120 135 150], 'Name', 'VeryHigh');
- % Dodawanie funkcji przynależności dla RSI
- fis = addMF(fis, 'RSI', 'trapmf', [0 0 10 20], 'Name', 'VeryLow');
- fis = addMF(fis, 'RSI', 'trapmf', [10 20 30 40], 'Name', 'Low');
- fis = addMF(fis, 'RSI', 'trapmf', [30 40 50 60], 'Name', 'Medium');
- fis = addMF(fis, 'RSI', 'trapmf', [50 60 70 80], 'Name', 'High');
- fis = addMF(fis, 'RSI', 'trapmf', [70 80 90 100], 'Name', 'VeryHigh');
- % Dodawanie funkcji przynależności dla BuyDecision
- fis = addMF(fis, 'BuyDecision', 'trimf', [0 25 50], 'Name', 'VeryLow');
- fis = addMF(fis, 'BuyDecision', 'trimf', [25 50 75], 'Name', 'Low');
- fis = addMF(fis, 'BuyDecision', 'trimf', [50 75 100], 'Name', 'Medium');
- fis = addMF(fis, 'BuyDecision', 'trimf', [75 100 125], 'Name', 'High');
- fis = addMF(fis, 'BuyDecision', 'trimf', [100 125 150], 'Name', 'VeryHigh');
- % Dodawanie reguł
- rules = [
- 'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)'
- 'If FearAndGreed is very_low and RSI is low then BuySignal is high (1)'
- 'If FearAndGreed is very_low and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is very_low and RSI is high then BuySignal is low (1)'
- 'If FearAndGreed is very_low and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is low and RSI is very_low then BuySignal is very_high (1)'
- 'If FearAndGreed is low and RSI is low then BuySignal is high (1)'
- 'If FearAndGreed is low and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is low and RSI is high then BuySignal is low (1)'
- 'If FearAndGreed is low and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is medium and RSI is very_low then BuySignal is high (1)'
- 'If FearAndGreed is medium and RSI is low then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is high then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is very_high then BuySignal is low (1)'
- 'If FearAndGreed is high and RSI is very_low then BuySignal is medium (1)'
- 'If FearAndGreed is high and RSI is low then BuySignal is medium (1)'
- 'If FearAndGreed is high and RSI is medium then BuySignal is low (1)'
- 'If FearAndGreed is high and RSI is high then BuySignal is very_low (1)'
- 'If FearAndGreed is high and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is very_low then BuySignal is low (1)'
- 'If FearAndGreed is very_high and RSI is low then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is medium then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is high then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is very_high then BuySignal is very_low (1)'
- ];
- fis = addRule(fis, rules);
- % Wyświetlanie konfiguracji systemu
- fis
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement