global nb nv barras restric massa x0 nb = 16; nv = 8; barras=load('barras.txt'); nos=load('nos.txt'); xx=zeros(2*nv,1); restric=zeros(2*nv,1); % construcao de xx, vetor posicao inicial % construcao de restric, informando restricoes for i=1:nv xx(2*i-1)=nos(i,1); xx(2*i)=nos(i,2); massa(i)=nos(i,3); kode=nos(i,4); if (kode >= 10) restric(2*i)=1; if (kode == 1 | kode == 11) restric(2*i-1)=1; end end end %% plota estado atual for i=1:nb xyloc(1,1) = xx(2*barras(i,1)-1); xyloc(1,2) = xx(2*barras(i,1)); xyloc(2,1) = xx(2*barras(i,2)-1); xyloc(2,2) = xx(2*barras(i,2)); plot(xyloc(:,1),xyloc(:,2)); hold on; end axis([-1 2 -1 5]); pause; x0=xx;