现代设计与应用技术解析
1. 模糊逻辑控制器模拟
模糊逻辑控制器在许多领域都有广泛应用,下面是其MATLAB代码实现:
title('N S1 HS VHS MS');
grid on;
xlabel('Cooling');
ylabel('Membership');
temp=input('Enter the temperature value (10<= temp>=50):= ');
antecedent1=min(VS(find(x==temp)));
antecedent2=min(S(find(x==temp)));
antecedent3=min(C(find(x==temp)));
antecedent4=min(F(find(x==temp)));
antecedent5=min(VF(find(x==temp)));
antecedent=[antecedent1 antecedent2 antecedent3 antecedent4 antecedent5]
consequent1=(N.*antecedent5);
consequent2=(S1.*antecedent4);
consequent3=(HS.*antecedent3);
consequent4=(VHS.*antecedent2);
consequent5=(MS.*antecedent1);
consequent=[consequent1 consequent2 consequent3 consequent4 consequent5]
subplot(2,2,3)
plot(y, [consequent1;consequent2;co