📄 ctr_surf.m
字号:
function [x,y,z] = ctr_surf(ctr,ts,bo,steps)% [x,y,z] = ctr_surf(ctr,ts,bo,steps)%% Control surface of a two dimensional discrete fuzzy or neural controller.%% ctr = name of the controller (file). (Must be a string)% ts = sampling time - passed to the controller.% bo = [e-from e-to de-from de-to] = ranges for the x,y axes used for the% calculations.%% The controller must have to inputs. The warning 'divide by zero'% can be caused by empty spaces in the rulebank and the division in the% defuzzification routine.%% If this function is invoked without lefthand arguments, a surface and a% contour plot is produced. % With lefthand arguments the plots can be displayed by % contour(x,y,z), surf(x,y,z) etc.% % A big value for steps leads two more time needed for the calculation. % Start with step=10.%% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK%% 19-April-1994 bs=(bo(4)-bo(3))/steps;as=(bo(2)-bo(1))/steps;z=zeros(steps+1,steps+1); % +1 to get the full range.disp('Working, please wait...')e=bo(1);xv=zeros(3,1);% eset corresponds to the x-axis. deset corresponds to the y-axis.for x=1:steps+1, % x-axis corresponds to e - and the columns. de=bo(3); for y=1:steps+1, % y-axis corresponds to de - and the rows. u=[e;de]; o=feval(ctr,u,xv,ts); z(y,x)=o; xv(1)=e; xv(3)=o; de=de+bs; end; xv(2)=de; e=e+as;end;x=linspace(bo(1),bo(2),steps+1);y=linspace(bo(3),bo(4),steps+1);if nargout==0, subplot(2,2,1),surf(x,y,z); subplot(2,2,2),contour(x,y,z);end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -