Function 'subsindex' is not defined for values of class 'tf'

1 Ansicht (letzte 30 Tage)
Pulkit Sharma
Pulkit Sharma am 6 Mär. 2018
Kommentiert: Steven Lord am 20 Mär. 2018
I have been trying to work on GSO code, and it keeps showing this error I made sure there was no variable in any function called step. Does anyone point me towards what might be wrong?
Function 'subsindex' is not defined for values of class 'tf'.
Error in UpdateLuciferin (line 28) J(i,:)=k(2);
Error in GSO (line 34) UpdateLuciferin; % Update the luciferin levels at glowworms’
function UpdateLuciferin
global n A J Ell gamma ro
for i = 1 : n
T = A(i,1);
K = A(i,2);
G=[0 0 0 1 0 0 0 0 0;0 0 0 0 1 0 0 0 0;0 0 0 0 0 1 0 0 0;-0.003184 0 0 0 0 -0.0199 0 0 0.0199;0 0.0002985 0 0 0 0 0 0 0;0 0 -0.000398 0.00997 0 0 -0.00997 0 0;0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0];
B=[0 0 0;0 0 0;0 0 0;-1 0 0;0 -0.25 0;0 0 -0.5;1 0 0;0 1 0;0 0 1];
C=[1 0 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0];
D=0;
sys = ss(G,B,C,D);
i=tf(sys);
X=i(1,1);
Y=i(1,2);
Z=i(1,3);
num=[(0.6*(T^2)*K) 4.8*K*T 9.6*K];
den=[8*T 0];
tfPID=tf(num,den);
xtf=X*tfPID;
ytf=Y*tfPID;
ztf=Z*tfPID;
a=xtf/(1+xtf);
b=ytf/(1+ytf);
c=ztf/(1+ztf);
ftf=a+b+c;
y=step(ftf);
yinfo=stepinfo(y)
k=struct2cell(yinfo);
J(i,:)=k(2);
% The Matlab ’Peaks’ function is used here. Please replace it with
% the multimodal function for which peaks are sought
%J(i,:) =-(647.9-0.7276.*x+0.6765.*y-0.1455.*x.^2+0.2327.*x.*y-0.17.*y.^2+0.001928.*x.^3-0.003643.*x.^2.*y+0.00255.*x.*y.^2-0.0008596 .*y.^3+0.0001613.*x.^4-0.0002075.*x.^3.*y+(1.244e-05).*x.^2.*y.^2+(9.413e-06).*x.*y.^3+0.0001003.*y.^4);
Ell(i,:) = (1-ro)*Ell(i,:) + gamma*J(i,:);
end

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by