Error while using 'tunefis"

4 vues (au cours des 30 derniers jours)
Prakhar Goel
Prakhar Goel le 25 Mar 2023
Commenté : Prakhar Goel le 26 Mar 2023
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);

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Mar 2023
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
  1 commentaire
Prakhar Goel
Prakhar Goel le 26 Mar 2023
Thankyou, error resolved !!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fuzzy Inference System Tuning dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by