Roger Jang(張智星),Zadeh的学生)在对模糊的理解之上写的相当的完备。
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
/*
* Stand-alone codes for fuzzy inference systems. * J.-S. Roger Jang, 1994. * Copyright 1994-2002 The MathWorks, Inc. * $Revision: 1.12 $ $Date: 2002/06/17 12:47:24 $ */ /* This part is for MACs only */ #include <stdio.h> FILE *output_file; #define PRINTF macprintf int macprintf(char* format, ...) /* Start of the regular fismain.c */ /*********************************************************************** int DOUBLE **dataMatrix, **fisMatrix, **outputMatrix; /* obtain data matrix and FIS matrix */ /* build FIS data structure */ /* error checking */ /* debugging */ /* create output matrix */ /* evaluate FIS on each input vector */ /* print output vector */ /* clean up memory */ |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
/*
* Stand-alone codes for fuzzy inference systems. * J.-S. Roger Jang, 1994. * Copyright 1994-2002 The MathWorks, Inc. * $Revision: 1.12 $ $Date: 2002/06/17 12:47:24 $ */ /* Start of the regular main.c */ #include "fis.h" /*********************************************************************** double **dataMatrix, **fisMatrix, **outputMatrix; data_file = "dataMatrixFile.txt"; /* obtain data matrix and FIS matrix 从文件读入输入数据矩阵和模糊矩阵,将其放入二维矩阵中*/ /* build FIS data structure 建立模糊数据结构*/ /* error checking 错误检测*/ /* fisDebugging 调试数据输出*/ /* create output matrix 创建输出矩阵5x1*/ /* evaluate FIS on each input vector 获取输入->开始模糊推理->输出矩阵*/ /* print output vector 得到输出并打印*/ /* clean up memory 清理内存*/ getchar(); |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
#ifndef __FIS_H__
# define __FIS_H__ #include <stdio.h> /*********************************************************************** #ifndef ABS /* debugging macros */ #if (defined(MATLAB_MEX_FILE) && !defined(__SIMSTRUC__)) #define FREEMAT(mat,m) fisFreeMatrix(mat,m) /*********************************************************************** typedef struct fis_node { DOUBLE *bias; /*bias, to be tuned when no rules are fired*/ struct fis_node *next; typedef struct io_node { typedef struct mf_node { /*********************************************************************** /* define a standard memory access function with error checking */ char **fisCreateMatrix(int row_n, int col_n, int element_size); /*********************************************************************** /* Build/Free FIS node and load parameter from fismatrix directly */ void fisPrintData(FIS *fis); /*********************************************************************** /* given input vector and FIS data structure, return output */ /* return a FIS matrix with all information */ /* return data matrix */ #endif /* __FIS__ */ |
//输入数据
//方法及其参数选择
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
[System]
Name='Fuzzy1' Type='mamdani' Version=2.0 NumInputs=3 NumOutputs=1 NumRules=27 AndMethod='min' OrMethod='max' ImpMethod='prod' AggMethod='sum' DefuzzMethod='mom' [Input1] [Input2] [Input3] [Output1] [Rules] |
2 3 4 5 |
|
0 0 0
2 7 8 10 35 40 16 41 64 20 70 80 |