Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Accepted Answer

Torsten
Torsten on 30 Nov 2023
Edited: Torsten on 1 Dec 2023
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!