- "a" -- the x location at which the function stops being 0 and starts to rise
- "b" -- the x location of the peak, where the membership reaches 1, and the point at which the function starts falling again
- "c" -- the x location where the membership function stops falling and becomes 0 for the rest of x
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Can someone explain this error?
5 views (last 30 days)
Show older comments
Error using evalfismex Illegal parameters in fisTriangleMf() --> b > c
Error in evalfis (line 83) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
Accepted Answer
Walter Roberson
on 16 Feb 2018
This is quite similar to the recent https://www.mathworks.com/matlabcentral/answers/380732-error-with-evalfis-function#answer_303446
You have a triangle shaped FIS membership function, https://www.mathworks.com/help/fuzzy/trimf.html . Triangle membership functions are defined by three parameters:
In order for this to work properly, the location where the membership function stops falling and becomes 0 again, "c", must be after the location where the membership function reaches its peak, "b".
But in your FIS, you have a "c" value (marking end of the non-zero range) being less than the "b" value (marking the peak.) That is not valid.
20 Comments
jasleen kaur
on 17 Feb 2018
I have checked trim parameters the values are as per the guidelines still getting the same error
Walter Roberson
on 18 Feb 2018
At the command line command
dbstop if error
and run your code. When it stops in evalfis, save input and fis and numofpoints into a .mat file and attach that .mat file here for us to examine.
jasleen kaur
on 19 Feb 2018
Sir please have a look.
Walter Roberson
on 19 Feb 2018
Look at
fis.input(1).mf(2)
ans =
struct with fields:
name: 'LOW'
type: 'trimf'
params: [456687.92806951 632359.24622541 146310.607499114]
Notice that 146310.607499114 is less than 632359.24622541 . That is an invalid triangular modular function.
Your fis has a total of 8 of these invalid triangular modular functions (out of 34 modular functions)
Whatever you are doing is creating invalid FIS.
Are you doing something similar to alex tzal, using PSO to try to create FIS parameters?
jasleen kaur
on 20 Feb 2018
Yes, I am using PSO to tune ANFIS. Sir, when i check my params before running the code they seem to be fine but after running I am getting this error. What to do?
Walter Roberson
on 20 Feb 2018
Put in a linear constraint that forces the parameters to be in order, like I told alex tzal in https://www.mathworks.com/matlabcentral/answers/380732-error-with-evalfis-function#answer_303446
jasleen kaur
on 22 Feb 2018
Sir, I am unable to get this. Can you elaborate a bit how to put constraints.
Walter Roberson
on 22 Feb 2018
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
To be any more specific then this, I would need to see your call to the PSO, and I would need to know which PSO you are using.
jasleen kaur
on 25 Feb 2018
Edited: jasleen kaur
on 25 Feb 2018
Where do I put this constraint?? I am using PSO in my ANFIS as per:
Walter Roberson
on 25 Feb 2018
That code appears to not be designed for constraints.
The relevant section of code is TrainAnfisUsingPSO.m starting at line 129 "% Update Velocity".
If you look at the section from line 145 "% Apply Position Limits" then after the two lines that are there that use min() and max() you could try adding
particle(i).Position = sort(particle(i).Position);
jasleen kaur
on 25 Feb 2018
After adding this, error changed to:
Starting PSO ... Error using evalfismex Illegal parameters in fisTriangleMf() --> a > b
Error in evalfis (line 83) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
Error in TrainFISCost (line 40) y=evalfis(x,fis);
Error in TrainAnfisUsingPSO>@(x)TrainFISCost(x,fis,data) (line 7) Problem.CostFunction=@(x) TrainFISCost(x,fis,data);
Walter Roberson
on 25 Feb 2018
Could you remind me which MATLAB version you are using? When I test with the original code, everything works fine through training, but then there are some warning messages about the inputs being out of range for evaluating with the Input data after training. I am not seeing an error message with the original code in R2013a or R2017b.
jasleen kaur
on 25 Feb 2018
I am using R2017b. even I am able to run the original code without any error.
Walter Roberson
on 25 Feb 2018
I tracked down the reason for the warnings that I see in evaluation of the input data after the FIS is fully trained.
The training data ranges between 0.6 and 312.9 for the first column, and 612.1 and 1801.8 for the second column.
The test data ranges between 0.7 and 314 for the first column, and 576.2 to 1798.8 for the second column.
So the test data has a first column entry that is larger than trained for, and has a second column entry that is smaller than trained for, and has a second column entry that is larger than trained for. A total of 3 entries are affected by having this data that is outside the range trained for.
However, I do not see the evalfismex error that you reported originally. What did you need to do to trigger that original error, before you made the change to TrainAnfisUsingPSO.m that I had suggested in response to the problem?
jasleen kaur
on 26 Feb 2018
I just modified the code to incorporate my fuzzy model.
Walter Roberson
on 26 Feb 2018
I need the modified routines to investigate.
jasleen kaur
on 26 Feb 2018
my call is fis=TrainAnfisUsingPSO(fis,transposed)
fis here is the updated_fis
Walter Roberson
on 26 Feb 2018
I had to modify two files. One of them, SetFISParams, I had it sort the parameters it was setting for each individual fis transfer function. That was enough to get rid of the crashes due to invalid parameters. The much more extensive changes needed were to main, which was unable to do the plotting because your input data was stored in the form of structures containing tables whereas the code expected pure numeric arrays -- and also because you had no test data.
jasleen kaur
on 27 Feb 2018
Edited: jasleen kaur
on 27 Feb 2018
thank you so much sir for all your help and guidance. I am really grateful to you.
AMLES MOUB
on 10 Jan 2019
Hello,
Please, I want to know how to optimize the ANFIS in real time which is involved in a simulink diagram..
More Answers (0)
See Also
Categories
Find more on Fuzzy Logic in Simulink 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!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)