scurve.m

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

M
33
字号
function y = scurve(xl,xr,x,typ)
%
% Fuzzy s-curve
%
% function y = scurve(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 xl == xr,
  % build Boolean set ;
  y = x >= xr ;
else
  if typ == 0,
    % build cosine curve
    y = (cos((x - xr)*pi/s) + 1)/2 ;
  else
    % build straight line
    y = min(1,(x - xl)/s) ;
  end ;
  y = min( x >= xl , y ) ;       % put 0's on the left
  y = max( x >= xr , y ) ;       % put 1's on the right
end ;

⌨️ 快捷键说明

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