亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sfsup.c

?? 模糊控制工具箱,很好用的,有相應的說明文件,希望對大家有用!
?? C
?? 第 1 頁 / 共 5 頁
字號:
#ifndef S_FUNCTION_NAME
# define S_FUNCTION_NAME
#endif

#ifndef S_FUNCTION_LEVEL
# define S_FUNCTION_LEVEL 2
#endif

#include "simstruc.h"

#ifndef __STDC__
# define __STDC__ 1
#endif

/*
  * Copyright 1994-2005 The MathWorks, Inc.
 */
#ifndef __FIS__
# define __FIS__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.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(x,y) ( (x) > (y) ? (x) : (y) )
#endif
#ifndef MIN
# define MIN(x,y) ( (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(mat,m,n) printf(#mat " = \n"); fisPrintMatrix(mat,m,n)
#define FREEMAT(mat,m) printf("Free " #mat " ...\n"); fisFreeMatrix(mat,m)
#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(mat,m) fisFreeMatrix(mat,m)
#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 nparams;			/* length of params field */
	DOUBLE *params;			/* MF parameters */
	int userDefined;		/* 1 if the MF is user-defined */
	DOUBLE (*mfFcn)(DOUBLE, DOUBLE *); /* pointer to a mem. fcn */ 
	DOUBLE value;		    /* for Sugeno only */
	DOUBLE *value_array;	/* for Mamdani only, array of MF values */
} MF;

#endif /* __FIS__ */
/***********************************************************************
 File, arrays, matrices operations 
 **********************************************************************/
/* Copyright 1994-2002 The MathWorks, Inc.  */
/* $Revision: $  $Date: $  */

/* display error message and exit */
static void fisError(char *msg)
{
#ifdef MATLAB_MEX_FILE
	mexErrMsgTxt(msg);
#else
	PRINTF("%s\n",msg);
    exit(1);
#endif
}

#ifndef NO_PRINTF         /*in case for rtw and dSPACE use */

/* an friendly interface to fopen() */
static FILE *fisOpenFile(char *file, char *mode)
{
	FILE *fp, *fopen();

	if ((fp = fopen(file, mode)) == NULL){
		PRINTF("The file %s cannot be opened.", file);
		fisError("\n");
	}
	return(fp);
}

#endif


/* define a standard memory access function with error checking */
void *fisCalloc(int num_of_x, int size_of_x)
{
	void *ptr;

#if (defined(MATLAB_MEX_FILE) &&  !defined(__SIMSTRUC__))
	/* datstruc.c ln325 requires ptr = NULL when it supplies num_of_x = 0 */
	if (num_of_x == 0) 
            ptr = NULL; /* mxCalloc returns a NULL pointer if num_of_x or size_of_x = 0 */
	else {
            ptr = mxCalloc(num_of_x, size_of_x);
            /* however we still need to check that memory was allocated successfully,
               exclude the case when num_of_x = 0, and if unsuccessful issue an error */
            if (ptr == NULL)
                fisError("Could not allocate memory in mxCalloc function call.");}
#else /* a Simulink file (defined(__SIMSTRUC__)), or standalone is being created */
	if (num_of_x == 0) 
            ptr = NULL; /* calloc returns a NULL pointer if num_of_x or size_of_x = 0 */
	else {
            ptr = calloc(num_of_x, size_of_x);
            /* however we still need to check that memory was allocated successfully,
               exclude the case when num_of_x = 0, and if unsuccessful issue an error */
            if (ptr == NULL)
                fisError("Could not allocate memory in calloc function call.");}
#endif

        return(ptr);
}


char **fisCreateMatrix(int row_n, int col_n, int element_size)
{
	char **matrix;
	int i;

	if (row_n == 0 && col_n == 0)
		return(NULL);
	matrix = (char **)fisCalloc(row_n, sizeof(char *));
	if (matrix == NULL)
		fisError("Calloc error in fisCreateMatrix!");
	for (i = 0; i < row_n; i++) { 
		matrix[i] = (char *)fisCalloc(col_n, element_size);
		if (matrix[i] == NULL)
			fisError("Calloc error in fisCreateMatrix!");
	}
	return(matrix);
}


/* won't complain if given matrix is already freed */
static void fisFreeMatrix(void **matrix, int row_n)
{
	int i;
	if (matrix != NULL) {
		for (i = 0; i < row_n; i++) {
			FREE(matrix[i]);
		}
		FREE(matrix);
	}
}


static DOUBLE**fisCopyMatrix(DOUBLE **source, int row_n, int col_n)
{
	DOUBLE **target;
	int i, j;

	target = (DOUBLE **)fisCreateMatrix(row_n, col_n, sizeof(DOUBLE));
	for (i = 0; i < row_n; i++)
		for (j = 0; j < col_n; j++)
			target[i][j] = source[i][j];
	return(target);
}


#ifndef NO_PRINTF        /* not available for RTW and dSPACE */

static void fisPrintMatrix(DOUBLE **matrix, int row_n, int col_n)
{
	int i, j;
	for (i = 0; i < row_n; i++) {
		for (j = 0; j < col_n; j++)
			PRINTF("%.3f ", matrix[i][j]);
		PRINTF("\n");
	}
}

static void fisPrintArray(DOUBLE *array, int size)
{
	int i;
	for (i = 0; i < size; i++)
		PRINTF("%.3f ", array[i]);
	PRINTF("\n");
}

static void
fisPause()
{
	PRINTF("Hit RETURN to continue ...\n");
	getc(stdin);
}

#endif
/***********************************************************************
 Parameterized membership functions
 **********************************************************************/
/* Copyright 1994-2002 The MathWorks, Inc.  */
/* $Revision: $  $Date: $  */

/* Triangular membership function */
static DOUBLE fisTriangleMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], b = params[1], c = params[2];

	if (a>b)
		fisError("Illegal parameters in fisTriangleMf() --> a > b");
	if (b>c)
		fisError("Illegal parameters in fisTriangleMf() --> b > c");

	if (a == b && b == c)
		return(x == a);
	if (a == b)
		return((c-x)/(c-b)*(b<=x)*(x<=c));
	if (b == c)
		return((x-a)/(b-a)*(a<=x)*(x<=b));
	return(MAX(MIN((x-a)/(b-a), (c-x)/(c-b)), 0));
}

/* Trapezpoidal membership function */
static DOUBLE fisTrapezoidMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], b = params[1], c = params[2], d = params[3];
	DOUBLE y1 = 0, y2 = 0;

	if (a>b) {
		PRINTF("a = %f, b = %f, c = %f, d = %f\n", a, b, c, d);
		fisError("Illegal parameters in fisTrapezoidMf() --> a > b");
	}
        if (b>c)
         {
                PRINTF("a = %f, b = %f, c = %f, d = %f\n", a, b, c, d);      
                fisError("Illegal parameters in fisTrapezoidMf() --> b > c");
         }
	if (c>d) {
		PRINTF("a = %f, b = %f, c = %f, d = %f\n", a, b, c, d);
		fisError("Illegal parameters in fisTrapezoidMf() --> c > d");
	}

	if (b <= x)
		y1 = 1;
	else if (x < a)
		y1 = 0;
	else if (a != b)
		y1 = (x-a)/(b-a);

	if (x <= c)
		y2 = 1;
	else if (d < x)
		y2 = 0;
	else if (c != d)
		y2 = (d-x)/(d-c);

	return(MIN(y1, y2));
	/*
	if (a == b && c == d)
		return((b<=x)*(x<=c));
	if (a == b)
		return(MIN(1, (d-x)/(d-c))*(b<=x)*(x<=d));
	if (c == d)
		return(MIN((x-a)/(b-a), 1)*(a<=x)*(x<=c));
	return(MAX(MIN(MIN((x-a)/(b-a), 1), (d-x)/(d-c)), 0));
	*/
}

/* Gaussian membership function */
static DOUBLE fisGaussianMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE sigma = params[0], c = params[1];
	DOUBLE tmp;

	if (sigma==0)
		fisError("Illegal parameters in fisGaussianMF() --> sigma = 0");
	tmp = (x-c)/sigma;
	return(exp(-tmp*tmp/2));
}

/* Extended Gaussian membership function */
static DOUBLE fisGaussian2Mf(DOUBLE x, DOUBLE *params)
{
	DOUBLE sigma1 = params[0], c1 = params[1];
	DOUBLE sigma2 = params[2], c2 = params[3];
	DOUBLE tmp1, tmp2;

	if ((sigma1 == 0) || (sigma2 == 0))
		fisError("Illegal parameters in fisGaussian2MF() --> sigma1 or sigma2 is zero");

	tmp1 = x >= c1? 1:exp(-pow((x-c1)/sigma1, 2.0)/2);
	tmp2 = x <= c2? 1:exp(-pow((x-c2)/sigma2, 2.0)/2);
	return(tmp1*tmp2);
}

/* Sigmoidal membership function */
static DOUBLE fisSigmoidMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], c = params[1];
	return(1/(1+exp(-a*(x-c))));
}

/* Product of two sigmoidal functions */
static DOUBLE fisProductSigmoidMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a1 = params[0], c1 = params[1], a2 = params[2], c2 = params[3];
	DOUBLE tmp1 = 1/(1+exp(-a1*(x-c1)));
	DOUBLE tmp2 = 1/(1+exp(-a2*(x-c2)));
	return(tmp1*tmp2);
}

/* Absolute difference of two sigmoidal functions */
static DOUBLE fisDifferenceSigmoidMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a1 = params[0], c1 = params[1], a2 = params[2], c2 = params[3];
	DOUBLE tmp1 = 1/(1+exp(-a1*(x-c1)));
	DOUBLE tmp2 = 1/(1+exp(-a2*(x-c2)));
	return(fabs(tmp1-tmp2));
}

/* Generalized bell membership function */
static DOUBLE fisGeneralizedBellMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], b = params[1], c = params[2];
	DOUBLE tmp;
	if (a==0)
		fisError("Illegal parameters in fisGeneralizedBellMf() --> a = 0");
	tmp = pow((x-c)/a, 2.0);
	if (tmp == 0 && b == 0)
		return(0.5);
	else if (tmp == 0 && b < 0)
		return(0.0);
	else
		return(1/(1+pow(tmp, b)));
}

/* S membership function */
static DOUBLE fisSMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], b = params[1];
	DOUBLE out;

	if (a >= b)
		return(x >= (a+b)/2);

	if (x <= a)
		out = 0;
	else if (x <= (a + b)/2)
		out = 2*pow((x-a)/(b-a), 2.0);
	else if (x <= b)
		out = 1-2*pow((b-x)/(b-a), 2.0);
	else
		out = 1;
	return(out);
}

/* Z membership function */
static DOUBLE fisZMf(DOUBLE x, DOUBLE *params)
{
	DOUBLE a = params[0], b = params[1];
	DOUBLE out;

	if (a >= b)
		return(x <= (a+b)/2);

	if (x <= a)
		out = 1;
	else if (x <= (a + b)/2)
		out = 1 - 2*pow((x-a)/(b-a), 2.0);
	else if (x <= b)
		out = 2*pow((b-x)/(b-a), 2.0);
	else

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青娱乐精品视频在线| 欧美色国产精品| 日本韩国欧美一区| 欧美一级高清片在线观看| 国产精品国产精品国产专区不片| 日本视频一区二区| 99久久久国产精品| 久久久三级国产网站| 午夜激情久久久| 日本丶国产丶欧美色综合| 国产精品美女久久久久aⅴ| 蜜臀av一级做a爰片久久| 欧美色精品在线视频| 日韩毛片视频在线看| 国产精品91一区二区| 欧美tickling挠脚心丨vk| 午夜亚洲福利老司机| 99久久99久久精品免费看蜜桃| 久久亚洲一区二区三区四区| 奇米色一区二区| 337p亚洲精品色噜噜狠狠| 夜夜精品视频一区二区| 99re这里只有精品首页| 国产精品你懂的| 风流少妇一区二区| 久久久99精品免费观看不卡| 国产一区二区三区免费观看| 精品99久久久久久| 极品少妇一区二区三区精品视频 | 国产精品影视在线观看| 日韩久久久精品| 久久不见久久见中文字幕免费| 在线电影欧美成精品| 天堂一区二区在线免费观看| 欧美一区二区啪啪| 日韩高清在线电影| 日韩美一区二区三区| 麻豆精品一区二区三区| 精品久久久久久久久久久院品网| 久久精品72免费观看| 久久久久久久网| 成人在线视频一区二区| ...xxx性欧美| 欧美日精品一区视频| 丝袜美腿亚洲综合| 精品久久一区二区| 成人小视频在线| 亚洲视频一区二区免费在线观看| 一本色道**综合亚洲精品蜜桃冫 | 国产色一区二区| 粉嫩一区二区三区在线看| 国产精品盗摄一区二区三区| 色先锋aa成人| 天堂久久一区二区三区| 精品久久久久久久一区二区蜜臀| 国产精品一区专区| 日韩一区在线播放| 欧美高清视频www夜色资源网| 久久精品国产色蜜蜜麻豆| 国产午夜亚洲精品不卡| 在线一区二区三区四区五区| 日韩电影在线观看网站| 日本一区二区三区四区在线视频| 91在线视频官网| 日韩电影一区二区三区四区| 欧美国产日韩在线观看| 欧美性大战xxxxx久久久| 老司机午夜精品| 国产精品久99| 日韩一区二区三| 99久久综合色| 国产精品福利电影一区二区三区四区| 欧美亚洲精品一区| 国产1区2区3区精品美女| 亚洲电影中文字幕在线观看| 久久久不卡网国产精品二区| 欧美视频一区在线| 成人免费视频app| 日韩制服丝袜先锋影音| 国产精品久久久爽爽爽麻豆色哟哟| 欧美裸体bbwbbwbbw| 成人一区二区三区中文字幕| 免费高清不卡av| 亚洲欧美日韩国产成人精品影院 | 美国毛片一区二区三区| 亚洲欧美自拍偷拍| 精品国产人成亚洲区| 欧美视频日韩视频| gogogo免费视频观看亚洲一| 精品一区二区三区在线播放视频 | 国产精品色在线观看| 日韩一区二区视频| 在线观看视频一区二区欧美日韩| 国产一本一道久久香蕉| 蜜臀久久久久久久| 偷拍一区二区三区四区| 国产精品国产精品国产专区不片| 欧美va亚洲va国产综合| 欧美精品第1页| 在线一区二区三区四区五区| 成人av网址在线| 国产馆精品极品| 国产裸体歌舞团一区二区| 日韩高清中文字幕一区| 亚洲一区二区三区四区五区中文| 成人欧美一区二区三区白人| 国产三级欧美三级日产三级99| 精品久久国产97色综合| 日韩一区二区三区在线视频| 欧美福利视频导航| 欧美日韩国产综合一区二区| 日本电影亚洲天堂一区| 色婷婷综合激情| 91国产成人在线| 欧美性大战久久| 欧美人狂配大交3d怪物一区| 欧美性xxxxxxxx| 欧美日韩性生活| 欧美日韩免费视频| 91精品国产综合久久久蜜臀图片| 欧美久久免费观看| 欧美一区二区在线视频| 91精品国产综合久久久久| 911精品国产一区二区在线| 欧美日韩国产精选| 欧美一三区三区四区免费在线看| 日韩欧美国产成人一区二区| 2024国产精品| 国产精品萝li| 亚洲男人天堂av| 亚洲第一激情av| 经典三级一区二区| 岛国精品在线播放| 在线免费视频一区二区| 91麻豆精品久久久久蜜臀| 91精品国产综合久久福利软件 | 欧美国产日韩亚洲一区| 一区免费观看视频| 亚洲六月丁香色婷婷综合久久 | 国产精品第五页| 亚洲一区二区三区四区的 | 欧美va在线播放| 国产精品素人一区二区| 亚洲午夜三级在线| 久久66热偷产精品| www.欧美色图| 欧美日韩情趣电影| 国产丝袜美腿一区二区三区| 亚洲色图第一区| 蜜桃视频免费观看一区| 国产成人av资源| 欧美日韩亚洲另类| 日本一区二区高清| 舔着乳尖日韩一区| 成人动漫一区二区| 日韩一区二区三区视频在线观看| 国产片一区二区| 日韩av成人高清| 99久久99久久精品免费看蜜桃| 欧美精品在线视频| 中文字幕免费观看一区| 亚洲成av人片一区二区梦乃| 国产一区二区三区高清播放| 色香色香欲天天天影视综合网 | 欧美色精品在线视频| 久久久久成人黄色影片| 亚洲电影视频在线| 成人97人人超碰人人99| 欧美成人aa大片| 亚洲亚洲人成综合网络| jiyouzz国产精品久久| 精品国产乱码久久久久久久久| 一区二区国产盗摄色噜噜| 成人性视频网站| 精品国产乱码久久| 日韩精品欧美成人高清一区二区| 一本一道综合狠狠老| 国产欧美日韩精品a在线观看| 丝袜脚交一区二区| 97精品电影院| 国产日产精品一区| 极品少妇xxxx精品少妇| 在线91免费看| 天堂成人国产精品一区| 欧美色图激情小说| 夜夜嗨av一区二区三区网页| heyzo一本久久综合| 国产精品午夜春色av| 国产成人亚洲综合a∨猫咪| 日韩欧美一区二区久久婷婷| 日本午夜精品一区二区三区电影| 91黄色激情网站| 夜夜精品视频一区二区| 欧美亚洲国产一区二区三区| 亚洲欧美国产高清| 91欧美激情一区二区三区成人| 国产精品久久毛片a| 91最新地址在线播放| 亚洲欧美日韩久久| 91国产成人在线|