Index exceeds the number of array elements. Index must not exceed 4.

1 次查看(过去 30 天)
m = 3;
k = 120;
w2 = k/m;
beta = 1/12;
gamma = 1/2;
dt1 = 1/sqrt(k/m);
t1 = 0:dt1:5;
nt1 = length(t1)
nt1 = 32
autovalores1 = zeros(nt1,1);
for i = 1:nt1
G1 = [(1-(1/2-beta)*w2.*t1(i).^2)/(1+(beta*w2.*t1(i).^2)),t1(i)/(1+(beta*w2.*t1(i).^2));
w2.*t1(i).*((gamma/2-beta)*w2.*t1(i).^2-1)/(1+(beta*w2.*t1(i).^2)),(1+(beta-gamma)*w2.*t1(i).^2)/(1+(beta*w2.*t1(i).^2))];
autovalores1(i) = abs(eig(G1(i)));
end
Index exceeds the number of array elements. Index must not exceed 4.
How do I fix this?

采纳的回答

Torsten
Torsten 2023-11-30
编辑:Torsten 2023-12-1
Maybe you mean
for i = 1:nt1
G1 = [(1-(1/2-beta)*w2.*t1(i).^2)/(1+(beta*w2.*t1(i).^2)),t1(i)/(1+(beta*w2.*t1(i).^2));
w2.*t1(i).*((gamma/2-beta)*w2.*t1(i).^2-1)/(1+(beta*w2.*t1(i).^2)),(1+(beta-gamma)*w2.*t1(i).^2)/(1+(beta*w2.*t1(i).^2))];
autovalores1(i) = abs(max(eig(G1)))
end
?
Or maybe
autovalores1(i) = max(abs(eig(G1)))
? I'm not sure.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by