Error while using 'tunefis"

4 次查看(过去 30 天)
I am trying to learn tuning a FIS, I created a training data set matrix 'data' 52x3
i am simply following the matab sample code to tune a FIS, and modified it for my need
I checked that my input training data set is perfectly loaded in workspace, but I am getting an error which says :
fisout = tunefis(tfis,[in;out;rule],trnX,trnY,options);
"Error using tunefis
Third argument must be input training data or a function handle to custom cost function."
The problem is i can see that input training data "trnX" is available in workspace
I am aware that the code is inefficient, I have attached all files needed to run this code
filename = 'Data.xlsx';
readtable(filename)
data = ans
X = data(:,1:2); %I = X
Y = data(:,3); %t=Y
trnX = X(1:2:end,:);
trnY = Y(1:2:end,:);
tfis = mamfis;
tfis.Inputs(1).Name = 'Ir';
tfis.Inputs(1).Range = [0,10];
tfis.Inputs(1).MembershipFunctions(1).Name = 'h';
tfis.Inputs(1).MembershipFunctions(1).Type = 'trapmf';
tfis.Inputs(1).MembershipFunctions(2).Name = 'm';
tfis.Inputs(1).MembershipFunctions(2).Type = 'trapmf';
tfis.Inputs(1).MembershipFunctions(3).Name = 'l';
tfis.Inputs(1).MembershipFunctions(3).Type = 'trapmf';
tfis.Inputs(2).Name = 'Iy';
tfis.Inputs(2).Range = [0,10];
tfis.Inputs(2).MembershipFunctions(1).Name = 'h';
tfis.Inputs(2).MembershipFunctions(1).Type = 'trapmf';
tfis.Inputs(2).MembershipFunctions(2).Name = 'm';
tfis.Inputs(2).MembershipFunctions(2).Type = 'trapmf';
tfis.Inputs(2).MembershipFunctions(3).Name = 'l';
tfis.Inputs(2).MembershipFunctions(3).Type = 'trapmf';
tfis.Outputs(1).Name = 'T';
tfis.Outputs(1).Range = [0 15];
tfis.Outputs(1).MembershipFunctions(1).Name = 'l';
tfis.Outputs(1).MembershipFunctions(1).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(2).Name = 'm';
tfis.Outputs(1).MembershipFunctions(2).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(3).Name = 's';
tfis.Outputs(1).MembershipFunctions(3).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(4).Name = 'b';
tfis.Outputs(1).MembershipFunctions(4).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(5).Name = 'c';
tfis.Outputs(1).MembershipFunctions(5).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(6).Name = 'd';
tfis.Outputs(1).MembershipFunctions(6).Type = 'trapmf';
tfis.Outputs(1).MembershipFunctions(7).Name = 'e';
tfis.Outputs(1).MembershipFunctions(7).Type = 'trapmf';
[in,out,rule] = getTunableSettings(tfis);
options.OptimizationType = 'tuning';
options.Method = 'patternsearch';
options.MethodOptions.MaxIterations = 52;
options.MethodOptions.UseCompletePoll = true;
rng('default')
fisout = tunefis(tfis,[in;out;rule],trnX,trnY,options);

采纳的回答

Walter Roberson
Walter Roberson 2023-3-25
You are using readtable. When you use () indexing on a table object the result is a table object. Use {} indexing or use dot indexing with the column name like
data.Xcva

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fuzzy Inference System Tuning 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by