Error with evalfis function
Show older comments
When I run evalfis, I get the following error "Error using evalfismex Illegal parameters in fisTrapezoidMf() --> b > c". Can you please help?
3 Comments
jasleen kaur
on 17 Feb 2018
I have a similar problem. Did you resolve it? Plz help!
alex tzal
on 19 Feb 2018
Walter Roberson
on 19 Feb 2018
alex: did you try putting in the linear constraint like I indicated?
Answers (1)
Walter Roberson
on 5 Feb 2018
0 votes
It sounds as if you are calling fisTrapezoidMf with three parameters in which the second parameter is greater than the third parameter, but that routine needs the third parameter to be greater than the second parameter.
8 Comments
Walter Roberson
on 5 Feb 2018
The implication is that the FIS you are asking to evaluate is not valid.
You added a trapazoid modular function to your FIS. https://www.mathworks.com/help/fuzzy/trapmf.html That involves four parameters. The range over which the trapazoid is intended to have a transfer function of 1 needs to be specified with increasing x values, but in your system you have the upper end of the 1 region in the place where you should have the lower end of the 1 region.
alex tzal
on 8 Feb 2018
Walter Roberson
on 8 Feb 2018
evalfismex is an undocumented internal helper function. evalfis() detects which kind of FIS is involved and calls fisTrapezoidMf() to evaluate the fis. fisTrapezoidMf() is not doing error checking on the validity of the parameters before calling the internal C-language coded evalfismex for performance reasons. evalfismex is looking at the trapezoid FIS that you passed in and is determining that you build it incorrectly and is giving an error.
When you provide invalid parameters for a FIS, the error has to be detected somewhere, and it just so happens to be detected in evalfismex . Not because evalfismex is doing anything magic: the MATLAB code level is allowing evalfismex to do the error detection because it is faster to have the C code do that.
So the problem is in the FIS that you are providing to be evaluated. You should use the FIS editor and examine the parameters you are passing for each trapezoid, to detect the one where in the set of four parameters [a b c d] that the second parameter (beginning of the region of 1's) is greater than the third parameter (end of the region of 1's)
alex tzal
on 10 Feb 2018
Walter Roberson
on 10 Feb 2018
Please attach your code and your data. You can zip everything together and attach the .zip
"Could you please clarify what you mean by region 1?"
Look at the Description section of https://www.mathworks.com/help/fuzzy/trapmf.html . Look at the equation defining f(x;a, b, c, d) . Look at the middle row, where it says
1, b <= x <= c
That means that the output of the FIS is defined to be the constant 1 if the input is between b and c (inclusive.)
The FIS believes that somewhere you have a c value that is less than the corresponding b value.
Walter Roberson
on 16 Feb 2018
None of those values matter in themselves for this purpose. What matters is that you need a linear constraint to prevent the third parameter from being less than the second parameter. In terms of A, b linear inequalities, that would look like
A = [1 -1 0 0;
0 1 -1 0;
0 0 1 -1]
b = [0; 0; 0]
The above permits the values to be exactly equal. Getting a strict inequality is tricky because of round-off error, but you could often approximate by setting b to -eps in each location instead of 0
Categories
Find more on Fuzzy Inference System Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!