how to DESIGN ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM (ANFIS)
11 次查看(过去 30 天)
显示 更早的评论
if my state space representation is given by:
%State-space representation of the system
A= [-23.5 120 32];
B= [18 0; 0 500; ];
C=[0 0 1 0 0 0];
D=[0 0;0 0];
1 个评论
Sam Chak
2024-1-8
It appears that there may have been an accident. I think the subsequent statement represents the initial description of the question provided by @welesh beyene:
------------------------------------------
if my state space representation is given by:
%State-space representation of the system
A= [-300 0 0 0 0 0; 0 -300 0 0 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1; 10.7206 -9.5648 10.7206 -9.5648 0 0; -9.5648 10.7206 -9.5648 10.7206 0 0];
B= [300 0; 0 300; 0 0; 0 0; 0 0; 0 0];
C=[0 0 1 0 0 0;0 0 0 1 0 0];
D=[0 0;0 0];
%states={'iA' 'iB' 'XA' 'XB' 'XdotA' 'XdotB'};
%inputs={'UA' 'UB'};
%outputs = {'YA' 'YB'};
sys=ss(A,B,C,D)
%Open-Loop Step Response
step(sys)
title('Open-Loop Step Response')
figure(1)
% check the controllability of the system
Ct=ctrb(A,B);
rank(Ct)
if rank(Ct)<rank(A);
disp('the system is not controllable')
else
disp('the system is controllable')
end
% check the observability of the system
Ob=obsv(A,C);
rank(Ob)
if rank(Ob)<rank(A);
disp('the system is not observable')
else
disp('the system is observable')
end
回答(1 个)
Sam Chak
2022-8-14
Have already recommended you to use ode45() function. Links and Examples were given previously.
This should generate the inputs–outputs that you need to train the ANFIS:
[t, x] = ode45(@system, [0 10], [0; 0; 0; 0; 0; 0]);
figure(1)
subplot(211), plot(t, x(:,3)), grid on, xlabel('t'), ylabel('y_3')
subplot(212), plot(t, x(:,4)), grid on, xlabel('t'), ylabel('y_4')
A = [-300 0 0 0 0 0; 0 -300 0 0 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1; 10.7206 -9.5648 10.7206 -9.5648 0 0; -9.5648 10.7206 -9.5648 10.7206 0 0];
B = [300 0; 0 300; 0 0; 0 0; 0 0; 0 0];
Q = diag([0.1, 0.1, 0.1, 0.1, 1, 1]);
R = diag([10, 10]);
K = lqr(A, B, Q, R);
u1 = - K(1,:)*x' + 1;
u2 = - K(2,:)*x' + 1;
data1 = [x u1']; % Data Set 1
data2 = [x u2']; % Data Set 2
figure(2)
subplot(211), plot(t, u1), grid on, xlabel('t'), ylabel('u_1')
subplot(212), plot(t, u2), grid on, xlabel('t'), ylabel('u_2')
% 6th-order system
function dxdt = system(t, x)
A = [-300 0 0 0 0 0; 0 -300 0 0 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1; 10.7206 -9.5648 10.7206 -9.5648 0 0; -9.5648 10.7206 -9.5648 10.7206 0 0];
B = [300 0; 0 300; 0 0; 0 0; 0 0; 0 0];
Q = diag([0.1, 0.1, 0.1, 0.1, 1, 1]);
R = diag([10, 10]);
K = lqr(A, B, Q, R);
r = [1; 1];
u = - K*x + r;
dxdt = A*x + B*u;
end
Because the following code for ANFIS training takes more 55 seconds, it won't work in the forum.
% setting up the ANFIS
genOpt = genfisOptions('GridPartition');
genOpt.NumMembershipFunctions = 3;
genOpt.InputMembershipFunctionType = 'gaussmf';
inFIS1 = genfis(data1(:,1:6), data1(:,7), genOpt);
opt1 = anfisOptions('InitialFIS', inFIS1, 'EpochNumber', 60);
fis1 = anfis(data1, opt1);
inFIS2 = genfis(data2(:,1:6), data2(:,7), genOpt);
opt2 = anfisOptions('InitialFIS', inFIS2, 'EpochNumber', 60);
fis2 = anfis(data2, opt2);
7 个评论
Sam Chak
2022-8-18
Simulink is probably suitable for you to build the State Space model and generate the needed data, where you can send them to the Workspace.
Please show the Simulink model first.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Inference System Tuning 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!