Error with evalfis function

When I run evalfis, I get the following error "Error using evalfismex Illegal parameters in fisTrapezoidMf() --> b > c". Can you please help?

3 Comments

I have a similar problem. Did you resolve it? Plz help!
Unfortunately,not:-(
alex: did you try putting in the linear constraint like I indicated?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 5 Feb 2018
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

alex tzal
alex tzal on 5 Feb 2018
Edited: alex tzal on 5 Feb 2018
Thank you for your answer. More specifically the error is in:
evalfis (line 84) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints).
I do not understand the use of fisTrapezoidMf in evalfismex. Could you please help?
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.
Many thanks for your feedback.Indeed, I do use a trapmef function to create my FIS. However the problem is with evalfismex function,i.e. the following matlab error:
Error using evalfismex Illegal parameters in fisTrapezoidMf() --> b > c
Error in evalfis (line 84) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints)
Could you please help me find the description of evalfismex function so as to define how is it related to fisTrapezoidMf() function?
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)
Many thanks for your feedback. I have now opened the FIS editor and for all my imputs(i.e. 3)the second parameter of the trapmf function is smaller than the third. Could you please clarify what you mean by region 1?
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.
alex tzal
alex tzal on 10 Feb 2018
Edited: alex tzal on 10 Feb 2018
I am using PSO in my ANFIS as per:
The problem is identified when the Problem.VarMin, Problem.VarMax, Params.MaxIt and Params.nPop parameters change in the TrainFISCost function. Could you please help me understand how are these related to trapmf parameters?
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

Sign in to comment.

Categories

Asked:

on 4 Feb 2018

Commented:

on 19 Feb 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!