MATLAB: Couldn’t Find ‘X’ value of a Membership Function

funtionfuzzyMATLABplot

Hi,I have a problem finding out the corresponding 'x' value if membership value is given.
x=0:0.001:10;
mf1 = trapmf(x,[1 2 3 4]);
plot(x,mf1);
ylim([-0.05 1.05]);
Now,I want to find the value of 'X' if Membership Value for this function is '0.7'
Thanks in advance!

Best Answer

clc; clear all ;
x=0:0.001:10;
mf1 = trapmf(x,[1 2 3 4]);
plot(x,mf1);
ylim([-0.05 1.05]);
%

mfi = 0.7 ;
tol = 10^-6 ;
idx = find(abs(mf1-mfi)<tol) ;
%
hold on
plot(x(idx),mf1(idx),'*r');