View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Adaptive Neuro-Fuzzy Inference Systems (ANFIS) Library for Simulink

4.5 | 20 ratings Rate this file 89 Downloads (last 30 days) File Size: 759 KB File ID: #36098 Version: 1.30
image thumbnail

Adaptive Neuro-Fuzzy Inference Systems (ANFIS) Library for Simulink



09 Apr 2012 (Updated )

This Simulink library contains six ANFIS/CANFIS system variations.

| Watch this File

File Information

This library is for those who want to use the ANFIS/CANFIS system in the Simulink environment. Each model is implemented for training and operation in a sample-by-sample, on-line mode. For details see the included release notes. The main reference used to develop all the ANFIS/CANFIS models is:
Neuro-Fuzzy and Soft Computing: A Computational Approach to Learning and Machine Intelligence, Jyh-Shing Roger Jang, Chuen-Tsai Sun, Eiji Mizutani. Prentice Hall, Sept. 1997.


Ann and Fuzzy Art And Fuzzy Artmap Neural Networks inspired this file.

This file inspired Recurrent Fuzzy Neural Network (Rfnn) Library For Simulink.

Required Products Simulink
System Identification Toolbox
MATLAB release MATLAB 7.13 (R2011b)
MATLAB Search Path
/Gradient Consistency Check
/NFA Manual
Other requirements Fuzzy Logic Toolbox is required for running some demos.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (48)
04 Oct 2016 Fotios Mandanas

01 May 2016 kishore babu

how to find anfis toolbox is exist ....

Comment only
15 Apr 2016 yulian maulana

29 Mar 2016 Ilias Konsoulas

@ yulian

1) When you run the demo for the very first time, you should place a 0 at the "Initial ANFIS States [x0; d0;]" entry of the ANFIS Block Parameters form. Not in the InitFcn of the Callbacks.

2) Then you run the simulation. The learned states are stored in the file named anfis_equalize.mat in a single variable (matrix) named "anfis_states".

3) When you try to rerun the demo, in order to load the states, you uncomment the line: "load anfis_equalize.mat;" found in the OpenFcn of the Callbacks and place the name of the learned states variable (i.e. anfis_states) at the "Initial ANFIS States [x0; d0;]" entry of the ANFIS Block Parameters.

Good Luck and don't forget to provide your rating for this work.

Comment only
29 Mar 2016 yulian maulana

Hi Illias, thanks for the great work. But I have a problem here. I have tried to run the demo "adapt_equalizer. I already comment "load anfis_scatter_states.mat and gave the initial state zero (in initFcn, am I right?). But I keep getting the same error when I try to simulate it. It said "error evaluating parameter ini in adapt equalizer/ANFIS grid equalizer. The other error is "undefined function and variable 'anfis_states'. Could you help me? thank you.

Comment only
22 Mar 2016 Ilias Konsoulas

@ Ibrahim Seleem. I'm not sure that system identification on a Single-Input Multiple-Output System is a well-defined problem. You can always try CANFIS but success is very-very unlikely. You may consult a goos system identification book to see what is possible in system identification.

Comment only
22 Mar 2016 Ibrahim Seleem

I want to make identification to single-input multi-output system. I think I'll use CANFIS .is that right ??

Comment only
08 Jan 2016 Anish Nair

Amazing work by Ilias. Very helpful.

12 Oct 2015 fulden cantas

Thanks for the good work!

24 Apr 2015 Ilias Konsoulas

@ Alex Mao: I'm afraid that you can't increase/decrease the samples of this demo. If you want to alter the number of samples, you must modify the file SimDataGenAnfis1.m which is employed in order to create and formulate the training and checking data as required by simulink. Also, you can't alter the training/checking data sizes via the LE step function.

Comment only
24 Apr 2015 Alex Mao

Hi llias,

Thanks for your effort, I have tried the ANFIS_Scatter_MG based on your manual and it worked well. However, as your test data has 1000 samples, when I increase samples, the ANFIS scatter still output the first 1000 sample, can you provide some comments for solving this problem, thanks in advance.

Comment only
21 Apr 2015 Ilias Konsoulas

@Richard: Please describe the problem in more detail.

Comment only
20 Apr 2015 Richard

I am having issues understanding the states array that the anfis_art block prints out for the purposes of reconstructing the membership functions after each time step.

Comment only
04 Apr 2015 Sergei Paleichuk

23 Nov 2014 Ilias Konsoulas

@ In-hwan. Yes, they are the same. You must compile combinem.c with mex and then call this function with same arguments as with comb that appears in grad_check_anfis_grid.m. Good Luck.

Comment only
23 Nov 2014 In-hwan

Thank you for your prompt response. ^^

But i can't find the "comb.c" file in your zip files.
Do you mean that "combinem.c" file is same with the "comb.c" file???

or I should find "comb.c" file for myself???

Comment only
21 Nov 2014 Ilias Konsoulas

@ In-hwan. This message appears because you haven't compiled the comb.c file to an mex executable using the mex command. Apply the mex command to the given comb.c source file and then you are ready to proceed with your simulations. Function comb.c was implemented in C for faster execution. Good Luck.

Comment only
21 Nov 2014 In-hwan

When i run the file "grad_check_anfis.m"
an error happens on the function "comb()"

the error message is:
Undefined function 'comb' for input arguments of type 'double'.

Error in grad_check_anfis_grid (line 116)
precond = comb(Out1);
How can i find a file defining the function "comb()"??

26 Sep 2014 Ilias Konsoulas

@ Junho.

When you run a demo for the very first time you must comment the line "load anfis_scatter_states.mat" or similar. In the "Initial States" entry you must enter a zero indicating you start training from scratch. When the first simulation session is complete, the anfis_scatter_states.mat has been generated in the current directory. Then you must uncomment the line "load anfis_scatter_states.mat". When you bouble click the box the learned states are loaded on the workspace. Then, in the "Initial States" entry of the form, you must enter the name of the variable (matrix) that contains the learned states.

Comment only
25 Sep 2014 Junho

Junho (view profile)

Dear Ilias,

I was following your manual to test your ANFIS demo version to see how ANFIS works. I'm pretty sure I fellow your direction correctly but it still makes me little confused of getting ~~.mat file. First, right click and go to properties of "Double-Click to load MG Data and ANFIS States" and open "OpenFcn*" inside Callbacks tab. Then comment % "load anfis_scatter.mat" and double-click the MG data box itself. After this part, I run this program to get "anfis_scatter.mat" but it never works for me. It keeps giving me an error "anfis_scatter_states is undefined". From your guide, I have to enter the name of variable under "Initial ANFIS States" but I really have no idea which variable I have to put in to get ~~.mat file. If you don't mind, Could you give me an advise of your program?

Comment only
03 Aug 2014 NIPAPORN


24 Jul 2014 Ilias Konsoulas

@ mohand Ali and @ Marc O' Polo: Is the folder containing all the ANFIS/CANFIS files in your MatLab path ?

Comment only
24 Jul 2014 mohand Ali

Dear Marc O'Polo

I have same your problem
Error in S-function 'ANFIS_Grid_MG/ANFIS (Grid)/ANFIS': S-Function 'anfisim_grid' does not exist

if you find solve to this problem , kindly inform me

Comment only
15 Jul 2014 Marc O'Polo

Dear Ilias,
Thank you for the toolbox. However, I am getting the following error:
Error in S-function 'ANFIS_Grid_MG/ANFIS (Grid)/ANFIS': S-Function 'anfisim_grid' does not exist
This happens with any of the other blocks as well. Any help is much appreciated.

Comment only
10 Jul 2014 khaild

khaild (view profile)

the work is wonderful,thank you very much.

07 Jul 2014 ali khodaparasti

I do not have Adaptive Neuro-Fuzzy Inference Systems (ANFIS) Library in my simulink library.
what should I do?

Comment only
16 Jun 2014 khaild

khaild (view profile)

06 Jun 2014 Ilias Konsoulas

@Mohamed: Ok, thanks for the feedback. The bug was fixed. You may run every model with a single input signal form now on.

Comment only
03 Jun 2014 Mohamed abo el ella

can we use the anfis scatter with only one input because an error appears

Comment only
17 Apr 2014 Mahamadou Diarra

21 Jan 2014 Ilias Konsoulas

Roby, this is a problem caused by a malfunctioning (or non-existent) Signal Procesing Blockset. For more info, have a look here: . Good Luck.

Comment only
21 Jan 2014 roby jangam

Thank you sir
I do what ever you tell me but there is also another error is come

Failed to load library 'dspstat3' referenced by 'CANFIS_ART_Lorenz/RMS'

Caused by:
Unable to load block diagram 'dspstat3'

21 Jan 2014 roby jangam

28 Dec 2013 Ilias Konsoulas

Roby, right-click on the block named "Double-click to load Lorenz Attractor Data". Select Block Properties -> Callbacks -> OpenFcn. There, together with other commands, add the following definition: sim_time = 2000; Also, note that in Simulation/Configuration Parameters/Stop Time enter: sim_time. And you're done.

Comment only
27 Dec 2013 roby jangam

i have a problem with CANFIS_ART_Lorenz.mdl

Error evaluating expression 'sim_time' for 'Stop time' specified in the Configuration Parameters dialog for block diagram 'CANFIS_ART_Lorenz': Undefined function or variable 'sim_time'.

so kindly please help me

27 Dec 2013 roby jangam

19 Nov 2013 Lejla BM

Thank you for your ANFIS and RFNN tools. It is very intresting work!

Fahrudin and Lejla

26 Aug 2013 Vesna Ojleska

Nice work.
Thank you.

19 Jul 2013 Ilias Konsoulas

Please note that the recently added feature of "gradient consistency checking" is introduced in par. 7.2 of the latest version of the NFA library user's manual.

Comment only
12 Feb 2013 Mohamed abo el ella

Dear Mr. Ilias Konsoulas

i have a problem with CANFIS_SCATTER
as when i enter two inputs with two error signals to get 2 outputs using MUX block it gives me an error during running by "Index exceeds matrix dimensions."

29 Dec 2012 nazar dikhil

please can I get the matlab code of anfismex function

21 Nov 2012 Sally

Sally (view profile)

Dear Mr.Ilias Konsoulas,
Thank you so much for your help.

Comment only
24 Oct 2012 Ilias Konsoulas

To Sally and others: In the updated version of the NFA User's Manual, a new section has been added describing how to run successfully the demos on your computer. Good Luck and thanks for your patience.

Comment only
02 Oct 2012 Ilias Konsoulas

Ok, in the next few days I'll add a new section on the user's guide: "NFA User's Manual v2.pdf"
to describe in more detail how to run successfully the demos. Just wait a little bit. Thanks.

Comment only
29 Sep 2012 Sally

Sally (view profile)

Dear Ilias Konsoulas,

Thanks for introducing the useful ANFIS library. I tried to run the demo programs but still gave me errors. Can you help me how to run that demos, Thank you so much.

Comment only
05 Jul 2012 Ilias Konsoulas

Quick fix: rename library file NFA.mdl to NFA_matlab.mdl .

Comment only
04 Jul 2012 Ahmet

Ahmet (view profile)

doesnt exist NFA_matlab

04 Jul 2012 Ahmet

Ahmet (view profile)

tying to run demo models gives erros as:

*Failed to load library 'NFA_matlab' referenced by 'ANFIS_Grid_MG/ANFIS (Grid)'
*Unable to load block diagram 'NFA_matlab'

How can i fix this? please help.


10 Apr 2012 1.1

I have updated only the following form entries: a)Description, b)Tags c) Acknowledgement of other submissions.

23 Apr 2012 1.3

Minor code changes, better comments and NFA User Guide corrections.

09 Jul 2012 1.4

OK, I corrected the name of the library file from NFA.mdl to NFA_matlab.mdl in order to make demos runnable.

24 Oct 2012 1.26

In the latest version of the users guide, I have included a new section describing how to make the demos runnable on your computer and briefly outlining what each demo is about.

09 Jul 2013 1.27

Introduced the method of gradient consistency checking. This assures the correctness of your backprop implementation. I also provided .m scripts that perform gradient checking to all (C)ANFIS functions of this library.

06 Jun 2014 1.28

Fixed a bug in anfisim_scatter.m that prevented run with a single input. All models were tested for single input run successfully.

31 Mar 2015 1.29

Improved S-function syntax. Also killed a small bug. Updated library should run a bit faster.

01 May 2015 1.30

Killed some redundant variables and commands in s-function scripts. Added some new comments. Also introduced use of "if any(logical_condition)" loops instead of "if ~isempty(logical_condition) which should be a bit faster.

Contact us