필터 지우기
필터 지우기

Error while using 'tunefis"

조회 수: 4 (최근 30일)
Prakhar Goel
Prakhar Goel 2023년 3월 25일
댓글: Prakhar Goel 2023년 3월 26일
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
  댓글 수: 1
Prakhar Goel
Prakhar Goel 2023년 3월 26일
Thankyou, error resolved !!

댓글을 달려면 로그인하십시오.

추가 답변 (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