洗衣机的模糊控制MATLAB仿真

洗衣机的模糊控制MATLAB仿真

污泥和油脂隶属函数设计仿真程序

%Define N+1triangle membership function
clear all;
close all;
N=2;

x=0:0.1:100;
for i=1:N+1
    f(i)=100/N*(i-1);
end

u=trimf(x,[f(1),f(1),f(2)]);
figure(1);
plot(x,u);

for j=2:N
    u=trimf(x,[f(j-1),f(j),f(j+1)]);
    hold on;
    plot(x,u);
end
u=trimf(x,[f(N),f(N+1),f(N+1)]);
hold on;
plot(x,u);
xlabel('x');
ylabel('Degree of membership');

洗涤时间隶属函数设计仿真程序

%Define N+1 triangle membership function
clear all;
close all;
z=0:0.1:60;

u=trimf(z,[0,0,10]);
figure(1);
plot(z,u);

u=trimf(z,[0,10,25]);
hold on;
plot(z,u);

u=trimf(z,[10,25,40]);
hold on;
plot(z,u);

u=trimf(z,[25,40,60]);
hold on; 
plot(z,u);

u=trimf(z,[40,60,60]);
hold on;
plot(z,u);

xlabel('z');
ylabel('Degree of membership');

洗衣机模糊控制系统仿真程序

clear all;
close all;
a=newfis('fuzz-wash');

a=addvar(a,'input','x',[0,100]);  %Fuzzy Stain
a=addmf(a,'input',1,'SD','trimf',[0,0,50]);
a=addmf(a,'input',1,'MD','trimf',[0,50,100]);
a=addmf(a,'input',1,'LD','trimf',[50,100,100]);

a=addvar(a,'input','y',[0,100]);  %Fuzzy Axunge
a=addmf(a,'input',2,'NG','trimf',[0,0,50]);
a=addmf(a,'input',2,'MG','trimf',[0,50,100]);
a=addmf(a,'input',2,'LG','trimf',[50,100,100]);

a=addvar(a,'output','z',[0,60]);  %Fuzzy Time
a=addmf(a,'output',1,'VS','trimf',[0,0,10]);
a=addmf(a,'output',1,'S','trimf',[0,10,25]);
a=addmf(a,'output',1,'M','trimf',[10,25,40]);
a=addmf(a,'output',1,'L','trimf',[25,40,60]);
a=addmf(a,'output',1,'VL','trimf',[40,60,60]);

rulelist=[1 1 1 1 1;1 2 3 1 1;1 3 4 1 1;
    2 1 2 1 1;2 2 3 1 1;2 3 4 1 1;
    3 1 3 1 1;3 2 4 1 1;3 3 5 1 1;]
a=addrule(a,rulelist);
showrule(a)

a1=setfis(a,'DefuzzMethod','mom');
writefis(a1,'wash');
a2=readfis('wash');

figure(1);
plotfis(a2);
figure(2);
plotmf(a,'input',1);
figure(3);
plotmf(a,'input',2);
figure(4);
plotmf(a,'output',1);

ruleview('wash');   %Dynamic Simulation

x=60;
y=70;
z=evalfis([x,y],a2)  %Using fuzzy inference

运行效果

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猫头丁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值