evalmf
Evaluate fuzzy membership function
Description
This function evaluates type-1 and type-2 membership functions for specified input values and returns the corresponding membership values.
Examples
Evaluate a generalized bell-shaped membership function across a range of input values from 0 through 10.
x = 0:0.1:10;
mf = fismf("gbellmf",[2 4 6]);
y = evalmf(mf,x);Plot the evaluation.
plot(x,y)
xlabel("gbellmf, P = [2 4 6]")![Figure contains an axes object. The axes object with xlabel gbellmf, P = [2 4 6] contains an object of type line.](../examples/fuzzy/win64/EvaluateMembershipFunctionExample_01.png)
Create a vector of three Gaussian membership functions.
mf = [fismf("gaussmf",[0.9 2.5],Name="low"); fismf("gaussmf",[0.9 5],Name="medium"); fismf("gaussmf",[0.9 7.55],Name="high")];
Specify the input range over which to evaluate the membership functions.
x = (-2:0.1:12)';
Evaluate the membership functions.
y = evalmf(mf,x);
Plot the evaluation results.
plot(x,y) xlabel("Input (x)") ylabel("Membership value (y)") legend("low","medium","high")

Create a triangular type-2 membership function.
mf = fismftype2("trimf",[5 7 9],LowerLag=0.3,LowerScale=0.8);Evaluate the membership function across a range of input values from 0 through 10.
x = 0:0.1:10; [yUpper,yLower] = evalmf(mf,x);
Plot the evaluated upper and lower MFs.
plot(x,yUpper,x,yLower) legend("Upper MF","Lower MF",Location="northwest") xlabel("Input") ylabel("Membership value")

Input Arguments
Type-1 membership function, specified as a fismf object or a vector of such objects.
Input value, specified as a scalar, vector, or 2-D matrix. If
mf is a:
Single
fismfobject, then you can specifyxas a scalar, vector, or matrixVector of
fismfobjects, then you can specifyxas a scalar or vector
Type-2 membership function, specified as a fismftype2 object or a vector of such objects.
Output Arguments
Membership value for a type-1 membership function, returned as a scalar,
vector, or 2-D matrix. If mfT1 is a:
Single
fismfobject, thenyis a scalar, vector, or matrix with the same dimensions asx. Each element ofyis the evaluated membership value for the corresponding element ofx.Vector of
fismfobjects, thenyis an M-by-N matrix, where M and N are the lengths ofmfT1andx, respectively.y(i,j) is the evaluated value of membership functionmfT1(i) for input valuex(j).
Upper MF membership value for a type-2 membership function, returned as a
scalar, vector, or 2-D matrix. If mfT2 is a:
Single
fismftype2object, thenyis a scalar, vector, or matrix with the same dimensions asx. Each element ofyis the evaluated membership value for the corresponding element ofx.Vector of
fismftype2objects, thenyis an M-by-N matrix, where M and N are the lengths ofmfT2andx, respectively.y(i,j) is the evaluated value of membership functionmfT2(i) for input valuex(j).
Lower MF membership value for a type-2 membership function, returned as a
scalar, vector, or 2-D matrix. If mfT2 is a:
Single
fismftype2object, thenyis a scalar, vector, or matrix with the same dimensions asx. Each element ofyis the evaluated membership value for the corresponding element ofx.Vector of
fismftype2objects, thenyis an M-by-N matrix, where M and N are the lengths ofmfT2andx, respectively.y(i,j) is the evaluated value of membership functionmfT2(i) for input valuex(j).
Version History
Introduced before R2006aevalmf now takes a fismf
object as an input argument rather than the type and parameters of the membership
function. Also, you can now evaluate multiple membership functions by passing an
array of fismf objects to evalmf. There
are differences between these approaches that require updates to your code.
Previously, you evaluated a membership function for given input values,
x, by specifying the type of membership function,
type, and the membership functions parameters,
params.
y = evalmf(x,params,type);
Update your code to first create a fismf object,
mf. Then, pass this object to
evalmf.
mf = fismf(type,params); y = evalmf(mf,x);
Also, previously, to evaluate multiple membership functions you called
evalmf once for each membership function.
y1 = evalmf(x,params1,type1); y2 = evalmf(x,params2,type2); y3 = evalmf(x,params3,type3);
Now, you can evaluate multiple membership functions by passing an array of
fismf objects to evalmf.
mf1 = fismf(type1,params1); mf2 = fismf(type2,params2); mf2 = fismf(type3,params3); y = evalmf([mf1 mf2 mf3],x);
Here, y = [y1 y2 y3]';
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)