Info

This question is closed. Reopen it to edit or answer.

I want to present one of the parties two to two conjugated and plot the same number counter from a array

1 view (last 30 days)
clear all
m2=306.192; mb=6.80; mj=141.521; CI=0; CS=1.783; Q=35.669*10^4; w=109.662;
Cxx=21.401*10^3; Cxy=0; Cyx=0; Cyy=23.006*10^3; Kxx=22.953*10^6; Kxy=0; Kyx=0; Kyy=25.467*10^6;
C1xy=0; C1yx=0; K1xx=2.318*10^3; K1yy=2.318*10^3; K1xy=0; K1yx=0;ks=891.732*10^3;
C1xx=[179:10000:20179];
cn=length(C1xx);
E=zeros(12,3);
g=zeros(12,3);
S1=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0;
-ks./m2, -((w*CI)./m2+Q./m2), -(CI./m2+CS./m2), 0, ks./m2, (w*CI)./m2, CI./m2, 0, 0, 0, 0, 0;
-(w*CI)./m2+Q./m2, -ks./m2, 0, -(CI./m2+CS./m2), (w*CI)./m2, ks./m2, 0, CI./m2, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0;
ks./mj, (w*CI)./mj, CI./mj, 0, -(ks./mj+Kxx./mj), -(Kxy./mj+(w*CI)./mj), -(Cxx./mj+CI./mj), -Cxy./mj, Kxx./mj, Kxy./mj, Cxx./mj, Cxy./mj;
-(w*CI)./mj, ks./mj, 0, CI./mj, (w*CI)./mj-Kxy./mj, -(Kyy./mj+ks./mj), -Cyx./mj, -(Cyy./mj +CI./mj), -Kyx./mj, Kyy./mj, Cyx./mj, Cyy./mj;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1;
0, 0, 0, 0, (Kxx./mb), (Kxy./mb), (Cxx./mb), (Cxy./mb), -((Kxx./mb)+K1xx./mb), -((Kxy./mb)+K1xy./mb), -Cxx./mb, -(Cxy./mb+C1xy./mb);
0, 0, 0, 0, (Kxy./mb), (Kyy./mb), (Cyx./mb), (Cyy./mb), -((Kyx./mb)+K1yx./mb), -(Kyy./mb+K1yy./mb), -((Cyx./mb)+C1yx./mb), -Cyy./mb];
for k=1:cn
for i=1:3:12
for j=1:6
S2=zeros(12,12);
S2(11,11)=-C1xx(k)/mb;
S2(12,12)=-C1xx(k)/mb;disp(S2);
S=S1+S2;disp(S);
E(:,k)=eig(full(S));
disp(E(:,k));
E1(i,k)=E(i,k);
i=i+2;
disp(E1(i,k));
E2(j,k)=E1(i,k);
disp(E2(j,k));
[e(:,k),I(:,k)]=sort(imag(E2(:,k)));disp(e(:,k));
g(:,k)=real(E2(I(:,k)));disp(g(:,k));
% plot(C1xx(k),real(E2(I(1,k))));
figure(1)
hold on
end
end
end
??? Attempted to access E1(3,1); index out of bounds because numel(E1)=1.
Error in ==> matrice at 32 disp(E1(i,k));

Answers (1)

Walter Roberson
Walter Roberson on 11 Mar 2013
You assign to E1(i,k) at E1(i,k)=E(i,k); but then in the next statement you add 2 to i, and then try to display E1(i,k) .
Your "i" is a "for i" loop. Any change you make to "i" within the body of the loop will be permitted but it will only have effect until the end of that loop iteration, after which "i" will be set to the next value just as if you had not changed it inside the loop. If you find yourself changing a loop control variable inside the loop, you are probably using bad logic.

Tags

Community Treasure Hunt

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

Start Hunting!