📄 rtinf.m
字号:
function [rb,mtab] = rtinf(rt,e,de,andop,orop)% [rb,mtab] = rtinf(rt,andop,orop)%% Inference of a two-dimensional fuzzy-controller given by a ruletable.% rb = A vector containing the premise results for each rule.% The composition and defuzzification must follow after calling this % function.% rt = A matrix, the ruletable.% mtab = optional result matrix of the conjunction for every rule.% e,de = row vectors containing the membership of both crip values from e% and de for every linguistic term of each ling. variable e and de.% These vectors are produced by fuzzification routines.% andop = the t-norm operator for the conjunction. (given as a string)% orop = the s-norm operator for the disjunction. (given as a string)% Other operators possible. There must be only two input values and one% output-return value.% The orientation of the ruletable is defined as e in the horizontal and de% in the vertical orientation.% The membership and the ling. terms begin from the left with index one for% the lowest ling. value e.g ling. term like Negative Big.% The first row of de correspond to the index one and the lowest ling. value% Not used arrays must filled with zeros.%% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK%% 10-August 1993 [r,c]=size(rt);mtab=zeros(r,c);for i=1:c, for j=1:r, mtab(j,i)=feval(andop,e(i),de(j)); end;end;% mtab now contains the results of the conjunction for every rule.mav=max(max(rt)); % mav=number of ling. terms of the output-set.rb=zeros(mav,1); % the disjunction beetween the results of every rule with % the same linguistic output-term is following : for i=1:mav, % for every ling. term of the output-set. iv=find(rt==i); % iv=list of indices which correspond two one ling. term. if length(iv)>1, zw=feval(orop,mtab(iv(1)),mtab(iv(2))); for n=3:length(iv), zw=feval(orop,zw,mtab(iv(n))); end; rb(i)=zw; else rb(i)=mtab(iv); end; % there is only one rule with this ling. outputend;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -