%典型隶属函数仿真程序:3_2.m%Membership functionclear all;clear all;for (M=1:1:6)%M=6;if M==1 %(高斯型隶属函数) x=0:0.1:10; y=gaussmf(x,[2 5]); % figure(1); subplot(3,2,1);% plot(x,y,'k'); xlabel('x');ylabel('y'); title('Guassian membership function'); elseif M==2 %(广义钟型隶属函数) x=0:0.1:10; y=gbellmf(x,[2 4 6]);% figure(1); subplot(3,2,2);%分割图形窗口 plot(x,y,'b'); xlabel('x');ylabel('y'); title('General Bell membership function'); elseif M==3 %(S型隶属函数) x=0:0.1:10; y=sigmf(x,[2 4]);% figure(3); subplot(3,2,3);% plot(x,y,'g'); xlabel('x');ylabel('y'); title('S membership function'); elseif M==4 %(梯型隶属函数) x=0:0.1:10; y=trapmf(x,[2 5 7 8]);% figure(4); subplot(3,2,4);% plot(x,y,'r'); xlabel('x');ylabel('y'); title('Trapezoid membership function'); elseif M==5 %(三角型隶属函数) x=0:0.1:10; y=trimf(x,[3 6 8]); % figure(5); subplot(3,2,5);% plot(x,y,'c'); xlabel('x');ylabel('y'); title('Triangle membership function'); elseif M==6 %(z型隶属函数) x=0:0.1:10; y=zmf(x,[3 7]);% figure(6); subplot(3,2,6);% plot(x,y,'m'); xlabel('x');ylabel('y'); title('Z membership function') ;endend

评论