Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Unable to get expected results from ANFIS model.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have files (data101 to data501) with data points 59400 in each file. I have to train the anfis using this data files. I have tried this using below code –
load data101.mat;
numMFs = [9 8 7];
mfType = 'gbellmf';
in_fis101 = genfis1(data101,numMFs,mfType);
fprintf('-->%s\n','Start training first ANFIS network. It may take some time depending on your computer system.')
anfis21 = anfis(data101,in_fis101,51,[0 0 0 0]); % train first ANFIS network
save anfis21;
clear all;
load data201.mat;
numMFs = [9 8 7];
mfType = 'gbellmf';
in_fis201 = genfis1(data201,numMFs,mfType);
fprintf('-->%s\n','Start training second ANFIS network. It may take one minute depending on your computer system.')
anfis22 = anfis(data201,in_fis201,51,[0 0 0 0]); % train second ANFIS network
save anfis22;
clear all;
load data301.mat;
numMFs = [9 8 7];
mfType = 'gbellmf';
in_fis301 = genfis1(data301,numMFs,mfType);
fprintf('-->%s\n','Start training Third ANFIS network. It may take one minute depending on your computer system.')
anfis23 = anfis(data301,in_fis301,51,[0 0 0 0]);
save anfis23;
clear all;
load data401.mat;
numMFs = [9 8 7];
mfType = 'gbellmf';
in_fis401 = genfis1(data401,numMFs,mfType);
fprintf('-->%s\n','Start training fourth ANFIS network. It may take one minute depending on your computer system.')
anfis24 = anfis(data401,in_fis401,51,[0 0 0 0]); % train first ANFIS network
save anfis24;
clear all;
load data501.mat;
numMFs = [9 8 7];
mfType = 'gbellmf';
in_fis501 = genfis1(data501,numMFs,mfType);
fprintf('-->%s\n','Start training fifth ANFIS network. It may take one minute depending on your computer system.')
anfis25 = anfis(data501,in_fis501,51,[0 0 0 0]); % train first ANFIS network
save anfis25;
clear all;
So after this I used evalfis to get the results from the above stored anfis modules using below program –
X= input('x-coordinate=');
Y= input('y-coordinate=');
Z= input('z-coordinate=');
XYZ = [X Y Z];
load anfis21.mat;
load anfis22.mat;
load anfis23.mat;
load anfis24.mat;
load anfis25.mat;
THETA1P = evalfis(XYZ, anfis21); % theta1 predicted by anfis1
THETA2P = evalfis(XYZ, anfis22); % theta2 predicted by anfis2
THETA3P = evalfis(XYZ, anfis23); % theta3 predicted by anfis3
THETA4P = evalfis(XYZ, anfis24);
THETA5P = evalfis(XYZ, anfis25);
disp(['Theta1 = ' num2str(THETA1P)]);
disp(['Theta2 = ' num2str(THETA2P)]);
disp(['Theta3 = ' num2str(THETA3P)]);
disp(['Theta4 = ' num2str(THETA4P)]);
disp(['Theta5 = ' num2str(THETA5P)]);
E.g. When I gave below values
x-coordinate=-51.56158581
y-coordinate=-203.2673851
z-coordinate=-235.21962
I got below results
Theta1 = 0.63387
Theta2 = -2.2428
Theta3 = 0.28727
Theta4 = 0.58467
Theta5 = -0.12822
But when I put these values back to below program –
a2 = 431.8;
a3 = -20.32;
d2 = 149.09;
d4 = 433.07;
d6 = 56.25;
t1 = 0.63387
t2 = -2.2428
t3 = 0.28727
t4 = 0.58467
t5 = -0.12822
%t1 = 0.94801;
%t2 = -1.9518;
%t3 = 0.97338;
%t4 = 0.54344;
%t5 = -0.056813;
c1 = cos(t1);
s1 = sin(t1);
c2 = cos(t2);
s2 = sin(t2);
c3 = cos(t2+t3);
s3 = sin(t2+t3);
s4 = sin(t4);
c4 = cos(t4);
s5 = sin(t5);
c5 = cos(t5);
X= c1*(d6*((c3*c4*s5)+(s3*c5))+(s3*d4)+(a3*c3)+(a2*c2))-s1*((d6*s4*s5)+d2);
Y= s1*(d6*((c3*c4*s5)+(s3*c5))+(s3*d4)+(a3*c3)+(a2*c2))+c1*((d6*s4*s5)+d2);
Z= d6*((c3*c5)-(s3*c4*s5))+(c3*d4)-(a3*s3)-(a2*s2);
disp(['X = ' num2str(X)]);
disp(['Y = ' num2str(Y)]);
disp(['Z = ' num2str(Z)]);
I got below results –
X = -659.6894
Y = -304.8028
Z = 130.0477
Which is not correct, Can anyone tell me what is going wrong here? What should be the anfis parameter so that I will get correct answers.
2 Kommentare
Win co
am 17 Sep. 2013
Hi, Could you describe your problem : what is the purpose of your code? What do the variables (a*,b*,c*,t*,s*,c*) represent? Regards Winn
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!