该函数用于计算当前值在Left Shoulder Fuzzy Set中的隶属度。
getDegreeOfMembership(value, peak, left, right)
value
:(number) 当前需要计算隶属度的值。peak
:(number) Fuzzy Set的顶点。left
:(number) Fuzzy Set左侧的起始点。right
:(number) Fuzzy Set右侧的结束点。0~1
之间的实数,表示当前值在Fuzzy Set中的隶属程度。d1
,以及当前值所在区间右侧点和顶点的距离d2
。$$ degreeOfMembership= \left{ \begin{aligned} 1,\qquad\qquad\qquad\quad& value \le left \ 0,\qquad\qquad\qquad\quad& value \ge peak \ \frac{peak-value}{peak-left},\hspace{0.23cm}& left< value \le peak\ \frac{right-value}{right-peak},\hspace{0.23cm}& peak< value< right \end{aligned} \right. $$
const peak = 50;
const left = 20;
const right = 80;
const lsf = new LeftShoulderFuzzySet(peak, left, right);
const value1 = 40;
console.log(lsf.getDegreeOfMembership(value1, peak, left, right)); // 0.6
const value2 = 10;
console.log(lsf.getDegreeOfMembership(value2, peak, left, right)); // 1