zcurve.m

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

M
33
字号
function y = zcurve(xl,xr,x,typ)
%
% Inverted fuzzy s-curve
%
% function y = zcurve(xl,xr,x,typ)
%
% xl	    coordinate of the left break point
% xr	    coordinate of the right break point
% x	    running point from the universe
% typ	    0=cosine (non-linear), 1=linear
%
% The curve extends to infinity on both sides.
% In a non-fuzzy set, xl = xr.

% Jan Jantzen, rev. 94-01-30

s = abs(xr - xl) ;
if s == 0,
  % build Boolean set ;
  y = x <= xl ;
else
  if typ == 0,
    % build cosine curve
    y = (cos((x - xl)*pi/s) + 1)/2 ;
  else
    % build straight line
    y = min(1,(-x + xr)/s) ;
  end ;
  y = max( x <= xl , y ) ;	  % put 1's on the left
  y = min( x <= xr , y ) ;	  % put 0's on the right
end ;

⌨️ 快捷键说明

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