Académique Documents
Professionnel Documents
Culture Documents
1 of 4
jar:file:///C:/Program%20Files/MATLAB/R2011a/help/toolbox/fuzzy/hel...
This example demonstrates how to simulate a fuzzy inference system on a Windows platform using the stand-alone
fuzzy inference engine. In this example, you use the LCC C compiler shipped with MATLAB to compile the fuzzy inference
engine source codes.
1. Open a DOS Command Window and change the folder to matlabroot\toolbox\fuzzy\fuzzy .
Tip You can find the root folder of your MATLAB installation by typing matlabroot at the MATLAB
command prompt.
2. In the DOS Command Window, type the following command:
lcc -c fismain.c
This command creates the fismain.obj object file in the matlabroot\toolbox\fuzzy\fuzzy folder.
Note You may encounter the following error when executing the lcc command:
'lcc' is not recognized as an internal or external command, operable program
28/7/2558 12:33
Simulating Fuzzy Inference Systems Using the Fuzzy Inference Engine ::...
2 of 4
jar:file:///C:/Program%20Files/MATLAB/R2011a/help/toolbox/fuzzy/hel...
or batch file.
To learn how to troubleshoot this error, see the Including the lcc Command in the PATH Environment
Variable section.
3. In the DOS Command Window, type the following command:
lcclnk fismain.obj .
This command creates an executable file fismain.exe in the matlabroot\toolbox\fuzzy\fuzzy folder.
Note You may encounter the following error when executing the lcclnk command:
'lcclnk' is not recognized as an internal or external command, operable
program or batch file .
To learn how to troubleshoot this error, see the Including the lcclnk Command in the PATH Environment
Variable section.
4. Open MATLAB desktop, and change to your current working folder using the Current Folder field in the MATLAB
desktop toolbar.
5. At the MATLAB prompt, type the following command to create an input data file:
[x, y] = meshgrid(-5:5, -5:5);
input_data = [x(:) y(:)];
save fis_in input_data -ascii
This command saves the input data as a 121-by-2 matrix in the fis_in ASCII file in your current working folder.
Each row of the matrix represents an input vector.
6. Copy the FIS structure file mam21.fis from the matlabroot\toolbox\fuzzy\fuzdemos folder to your current
working folder.
7. Copy the stand-alone executable file fismain.exe from the matlabroot\toolbox\fuzzy\fuzzy folder to your
current working folder.
8. In the DOS Command Window, change the folder to your current working folder, and type the following command
to call the stand-alone executable code:
fismain fis_in mam21.fis
This command uses the data file fis_in and the FIS structure file mam21.fis, and generates 121 outputs on
your screen.
Tip You can also direct the outputs to a file using the following command in the DOS Command
Window:
fismain fis_in mam21.fis > fis_out
This command saves the output data fis_out as a 121-by-1 matrix in your current working folder. Each
row of the output matrix represents an output vector.
9. To verify that the fuzzy inference engine output matches the MATLAB MEX-file evalfis.m output, type the
following command at the MATLAB prompt:
fismat = readfis('mam21');
matlab_out = evalfis(input_data, fismat);
load fis_out
max(max(matlab_out - fis_out))
This command returns the following result:
ans =
4.9583e-013
The difference results from the relative precision between the outputs.
28/7/2558 12:33
Simulating Fuzzy Inference Systems Using the Fuzzy Inference Engine ::...
3 of 4
jar:file:///C:/Program%20Files/MATLAB/R2011a/help/toolbox/fuzzy/hel...
This example demonstrates how to simulate a fuzzy inference system on a UNIX platform using the stand-alone fuzzy
inference engine.
1. Open a UNIX Command Window and change the folder to matlabroot\toolbox\fuzzy\fuzzy .
Tip You can find the root folder of your MATLAB installation by typing matlabroot at the MATLAB
command prompt.
2. In the UNIX Command Window, type the following command:
cc -O -o fismain fismain.c -lm
This command creates the fismain file in the matlabroot\toolbox\fuzzy\fuzzy folder.
The fis.c file is included in the fismain.c file; you do not have to compile it separately.
3. At the MATLAB prompt, create an input data file using the following command:
[x, y] = meshgrid(-5:5, -5:5);
input_data = [x(:) y(:)];
save fis_in input_data -ascii
This command saves the input data as a 121-by-2 matrix in the ASCII file fis_in in your current working folder.
Each row of the matrix represents an input vector.
Tip You can find your current working folder in the Current Folder field in the MATLAB desktop toolbar.
4. Copy the FIS structure file mam21.fis from the matlabroot\toolbox\fuzzy\fuzdemos folder to your current
working folder.
5. Copy the fismain file from the matlabroot\toolbox\fuzzy\fuzzy folder to your current working folder.
6. In the UNIX Command Window, change the folder to your current working folder, and type the following executable
command:
fismain fis_in mam21.fis
This command uses the data file fis_in and the FIS structure file mam21.fis and generates 121 outputs on your
screen.
Tip You can also direct the outputs to another file using the following command in the DOS Command
Window:
28/7/2558 12:33
Simulating Fuzzy Inference Systems Using the Fuzzy Inference Engine ::...
4 of 4
jar:file:///C:/Program%20Files/MATLAB/R2011a/help/toolbox/fuzzy/hel...
Fuzzy Clustering
Yes
No
Function Reference
Terms of Use
Patents
Trademarks
Acknowledgments
28/7/2558 12:33