本来是用labview做的模糊控制,但论文需要,这个图又导不出来,只能将模糊规则导进matlab的fuzzy工具中。
labview的模糊工具保存的格式是 .fs,matlab的模糊工具是.fis。
一、导出surface
matlab中导出图片
参考:如何导出模糊控制器的surface viewer图
a=readfis('fuzzpid2');
figure(1)%kp
gensurf(a,[1,2],1)
set(gca,'FontName','Times New Roman','FontSize',8,'LineWidth',0.5);
xlabel('e','FontName','Times New Roman','fontsize',8);
ylabel('ec','FontName','Times New Roman','fontsize',8);
zlabel('Kp','FontName','Times New Roman','fontsize',8);
figure(2)%ki
gensurf(a,[1,2],2)
set(gca,'FontName','Times New Roman','FontSize',8,'LineWidth',0.5);
xlabel('e','FontName','Times New Roman','fontsize',8);
ylabel('ec','FontName','Times New Roman','fontsize',8);
zlabel('Ki','FontName','Times New Roman','fontsize',8);
figure(3)%kd
gensurf(a,[1,2],3)
set(gca,'FontName','Times New Roman','FontSize',8,'LineWidth',0.5);
xlabel('e','FontName','Times New Roman','fontsize',8);
ylabel('ec','FontName','Times New Roman','fontsize',8);
zlabel('Kd','FontName','Times New Roman','fontsize',8);
这里的a就是前面说的命名,中括号里1,2表示的是我自己设计的模糊控制器的第一个和第二个输入,最后的1就是我的第一个输出,要出第二输出的图就改成2,要出第三输出的图就改成3即可
即对应Kp、Ki 、Kd
二、导出隶属度函数
参考:如何将Matlab中“模糊控制设计器”的隶属度函数导出图片(figure)文章来源:https://www.toymoban.com/news/detail-505930.html
clc;
clear;
a=readfis('fuzzpid2');
h3=figure(1)%e
set(h3,'Position',[600,100,400,250]);
plotmf(a,'input',1);
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5);
xlabel('e (N)','FontName','Times New Roman','fontsize',10);
% xlabel('\fontsize{10}\fontname{Times new roman}e');
ylabel('\fontsize{10}\fontname{Times new roman}Degree of membership');
h3=figure(2)%ec
set(h3,'Position',[600,100,400,250]);
plotmf(a,'input',2);
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5);
xlabel('ec (N)','FontName','Times New Roman','fontsize',10);
ylabel('\fontsize{10}\fontname{Times new roman}Degree of membership');
h3=figure(3)
set(h3,'Position',[600,100,400,250]);
plotmf(a,'output',1);
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5);
xlabel('Kp','FontName','Times New Roman','fontsize',10);
ylabel('\fontsize{10}\fontname{Times new roman}Degree of membership');
h3=figure(4)
set(h3,'Position',[600,100,400,250]);
plotmf(a,'output',2);
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5);
xlabel('Ki','FontName','Times New Roman','fontsize',10);
ylabel('\fontsize{10}\fontname{Times new roman}Degree of membership');
h3=figure(5)
set(h3,'Position',[600,100,400,250]);
plotmf(a,'output',3);
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5);
xlabel('Kd','FontName','Times New Roman','fontsize',10);
ylabel('\fontsize{10}\fontname{Times new roman}Degree of membership');
文章来源地址https://www.toymoban.com/news/detail-505930.html
到了这里,关于(小记)matlab导出模糊控制器中的surface viewer和隶属度曲线的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!