balltabl.m

来自「为了下载东西」· M 代码 · 共 34 行

M
34
字号
function T2 = balltabl(BallRules)
%BALLTABL Calculate the control table for the ball controller
%  function T2 = balltabl(BallRules)
%
%  Rule base to table conversion
%
%  Input:   BallRules   1x9 binary vector indicating which rules are active
%  Output:  T2          Fuzzy control table for ball
%
%  In T2 row indices correspond to the
%  first variable, e.g., error.
%
%  Jantzen 941122
%  Revised Hordur Kvaran, 20.10.97

uni=cart(-100:10:100,-100:10:100) ;

%  Don't know the reason for this but this seems rather strange.
%  Why not do them all at once.  Saves reading the rulebase for
%  each call.     Hordur Kvaran, 20.10.97
T2(1:441)   = ballbase(uni(1:441,:),BallRules) ;
T2 = reshape(T2,21,21)';
T2 = (abs(T2)>1e-3).*T2 ;

%T2          = zeros(1,441);
%T2(1:100)   = ballbase(uni(1:100,:)) ;
%T2(101:200) = ballbase(uni(101:200,:)) ;
%T2(201:300) = ballbase(uni(201:300,:)) ;
%T2(301:400) = ballbase(uni(301:400,:)) ;
%T2(401:441) = ballbase(uni(401:441,:)) ;
%T2 = reshape(T2,21,21)';
%T2 = (abs(T2)>1e-3).*T2 ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?