資源簡(jiǎn)介
在VS2010環(huán)境下,建立控制臺(tái)應(yīng)用程序,調(diào)用經(jīng)修改過(guò)的MATLAB模糊邏輯工具箱中關(guān)于模糊控制部分的C代碼函數(shù),從而在C++中方便直接地實(shí)現(xiàn)模糊控制算法;
fisMatrixFile.txt中存放自己配置的模糊邏輯工具箱生成的fis文件,
dataMatrixFile.txt中存放模糊控制算法的輸入量。

代碼片段和文件信息
/*
?*?Stand-alone?C?codes?for?fuzzy?inference?systems.
?*?(This?file?is?included?in?fismain.c)
?*?J.-S.?Roger?Jang?1994.
?*?Copyright?1994-2001?The?MathWorks?Inc.?
?*/
/*
??*?Copyright?1994-2005?The?MathWorks?Inc.
?*/
//#ifndef?__FIS__
//#?define?__FIS__
#include?
#include?
#include?
#include?
#include?“fis.h“
/***********************************************************************
?Macros?and?definitions
?**********************************************************************/
/*?Define?portable?printf?and?double?*/
#if?defined(MATLAB_MEX_FILE)
#?define?PRINTF?mexPrintf
#?define?DOUBLE?real_T
#elif?defined(__SIMSTRUC__)
#?define?PRINTF?ssPrintf
#?define?DOUBLE?real_T
#else
#?define?PRINTF?printf
#?define?DOUBLE?double
#endif
#ifndef?ABS
#?define?ABS(x)???(?(x)?>?(0)???(x):?(-(x))?)
#endif
#ifndef?MAX
#?define?MAX(xy)?(?(x)?>?(y)???(x)?:?(y)?)
#endif
#ifndef?MIN
#?define?MIN(xy)?(?(x)?(y)???(x)?:?(y)?)
#endif
#define?MF_PARA_N?4
#define?STR_LEN?500
#define?MF_POINT_N?101
/*?debugging?macros?*/
/*
#define?PRINT(expr)?printf(#expr?“?=?%g\n“?(double)expr)
#define?PRINTMAT(matmn)?printf(#mat?“?=?\n“);?fisPrintMatrix(matmn)
#define?FREEMAT(matm)?printf(“Free?“?#mat?“?...\n“);?fisFreeMatrix(matm)
#define?FREEARRAY(array)?printf(“Free?“?#array?“?...\n“);?free(array)
*/
#if?(defined(MATLAB_MEX_FILE)?&&?!defined(__SIMSTRUC__))
#?define?FREE?mxFree
#else
#?define?FREE?free
#endif
#define?FREEMAT(matm)?fisFreeMatrix(matm)
#define?FREEARRAY(array)?FREE(array)
/***********************************************************************
?Data?types
?**********************************************************************/
typedef?struct?fis_node?{
int?handle;
int?load_param;
char?name[STR_LEN];
char?type[STR_LEN];
char?andMethod[STR_LEN];
char?orMethod[STR_LEN];
char?impMethod[STR_LEN];
char?aggMethod[STR_LEN];
char?defuzzMethod[STR_LEN];
int?userDefinedAnd;
int?userDefinedOr;
int?userDefinedImp;
int?userDefinedAgg;
int?userDefinedDefuzz;
int?in_n;
int?out_n;
int?rule_n;
int?**rule_list;
DOUBLE?*rule_weight;
int?*and_or; /*?AND-OR?indicator?*/
DOUBLE?*firing_strength;
DOUBLE?*rule_output;
/*?Sugeno:?output?for?each?rules?*/
/*?Mamdani:?constrained?output?MF?values?of?rules?*/
struct?io_node?**input;
struct?io_node?**output;
DOUBLE?(*andFcn)(DOUBLE?DOUBLE);
DOUBLE?(*orFcn)(DOUBLE?DOUBLE);
DOUBLE?(*impFcn)(DOUBLE?DOUBLE);
DOUBLE?(*aggFcn)(DOUBLE?DOUBLE);
DOUBLE?(*defuzzFcn)();
DOUBLE?*BigOutMfMatrix; /*?used?for?Mamdani?system?only?*/
????DOUBLE?*BigWeightMatrix;/*?used?for?Mamdani?system?only?*/
DOUBLE?*mfs_of_rule; /*?MF?values?in?a?rule?*/
DOUBLE?*bias;?/*bias?to?be?tuned?when?no?rules?are?fired*/
int?isbias;
struct?fis_node?*next;
}?FIS;
typedef?struct?io_node?{
char?name[STR_LEN];
int?mf_n;
DOUBLE?bound[2];
DOUBLE?value;
struct?mf_node?**mf;
}?IO;
typedef?struct?mf_node?{
char?label[STR_LEN]; /*?MF?name?*/
char?type[STR_LEN]; /*?MF?type?*/
int?n
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????42??2016-10-10?19:33??Fuzzy\Debug\dataMatrixFile.txt
?????文件???????1349??2016-10-10?19:35??Fuzzy\Debug\fisMatrixFile.txt
?????文件??????72192??2016-10-19?10:24??Fuzzy\Debug\Fuzzy_test.exe
?????文件?????395356??2016-10-19?10:24??Fuzzy\Debug\Fuzzy_test.ilk
?????文件?????445440??2016-10-19?10:24??Fuzzy\Debug\Fuzzy_test.pdb
?????文件?????????13??2016-10-19?10:24??Fuzzy\Fuzzy_test\dataMatrixFile.txt
?????文件????????722??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\cl.command.1.tlog
?????文件???????2298??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\CL.read.1.tlog
?????文件????????444??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\CL.write.1.tlog
?????文件???????5146??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.Build.CppClean.log
?????文件????????406??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.exe.em
?????文件????????472??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.exe.em
?????文件????????381??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.exe.intermediate.manifest
?????文件?????????91??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.lastbuildstate
?????文件??????11369??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.log
?????文件??????????0??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test.write.1.tlog
?????文件????????210??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\Fuzzy_test_manifest.rc
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件??????????2??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件???????1672??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件???????3568??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件????????978??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\li
?????文件?????127874??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\main.obj
?????文件????????438??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\mt.command.1.tlog
?????文件????????210??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\mt.read.1.tlog
?????文件????????402??2016-10-19?10:24??Fuzzy\Fuzzy_test\Debug\mt.write.1.tlog
............此處省略27個(gè)文件信息
評(píng)論
共有 條評(píng)論