下面的例子于两输入一输出的例子进行讲解,并在qt5.14版本进行实现。
main函数代码段
#include
#include
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
test *ads=new test;
ads->feed_speed(0,0);
delete ads;
return a.exec();
}
结果图
test类头文件
#ifndef TEST_H
#define TEST_H
#include //这里引用库文件fis.c
class test
{
public:
FIS *fis;
int i, j;
double **fisMatrix,**outputMatrix;
double * dataMatrix;
char *fis_file;
int fis_row_n, fis_col_n;
public:
test();
~test();
double feed_speed(double input1,double input2);
};
#endif // TEST_H
test类实现
#include "test.h"
test::test()
{
this->fis_file="F:\\cncF2.txt";
fisMatrix = returnFismatrix(fis_file, &fis_row_n, &fis_col_n);
/* build FIS data structure */
fis = (FIS *)fisCalloc(1, sizeof(FIS));
fisBuildFisNode(fis, fisMatrix, fis_col_n, MF_POINT_N);
outputMatrix = (DOUBLE **)fisCreateMatrix(1, fis->out_n, sizeof(DOUBLE));
this->dataMatrix=new double(2);
}
double test::feed_speed(double input1,double input2)
{
this->dataMatrix[0]=input1;
this->dataMatrix[1]=input2;
getFisOutput(dataMatrix, fis, outputMatrix[0]);
return outputMatrix[0][0];
}
test::~test()
{
fisFreeFisNode(fis);
fisFreeMatrix((void **)fisMatrix, fis_row_n);
fisFreeMatrix((void **)outputMatrix, 1);
delete[]dataMatrix;
}
点赞关注,fis.c文件代码段这里不提供(温馨提示csdn提供的fis.c仍需修改,不然跑不动)(如需使用请在此链接下载(27条消息) fuzzy的fis.c文件-嵌入式文档类资源-CSDN文库https://download.csdn.net/download/weixin_53351797/85502651?spm=1001.2014.3001.5501),csdn已经有很多此类资源,关注点赞本博主可以怎么修改成n输入m输出的fuzzy代码实现发给你和备注发给你.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)