function picvib1(par,t,K,M) % Prints some output values, % stores the "t" in the file t.dat % and plots the optimal structure xy = par.xy; m=par.m; ijk = par.ijk; cmp = par.cmp; n=par.n; maska=par.maska; BI=par.BI; f=par.f; coco = f'*inv(K)*f; str = sprintf( ' Compliance %0.6g , prescribed %0.6g ',coco,cmp ); disp(str); [VV,EE] = eig(K,M); [mineigK,iiee] = min(diag(EE)); dell = VV(:,iiee); del = zeros(n,1); del(maska) = dell; str = sprintf( ' Min eigenvalue: %0.6g ',mineigK); disp(str); sumt = sum(t); str = sprintf( ' Total wieght: %0.6g ',sumt); disp(str); ngrap=max(ijk(1:m,:))/2; ngra=max(ngrap); vol=zeros(m,1); for i=1:m x1=xy(ijk(i,2)/2,1); y1=xy(ijk(i,2)/2,2); x2=xy(ijk(i,4)/2,1); y2=xy(ijk(i,4)/2,2); len=sqrt((x1-x2)^2 + (y1-y2)^2); vol(i) = t(i)/len; end xmax=max(xy(1:ngra,1)); ymax=max(xy(1:ngra,2)); xymax=max(xmax,ymax); tmax=max(vol(1:m)); tscale=15/tmax; clf subplot(2,1,1) for i=1:m if(vol(i) > 0.001*tmax) th = tscale*vol(i); xgra(1)=xy(ijk(i,2)/2,1); ygra(1)=xy(ijk(i,2)/2,2); xgra(2)=xy(ijk(i,4)/2,1); ygra(2)=xy(ijk(i,4)/2,2); plot(xgra,ygra,'b-','LineWidth',th); hold on end end axis('equal') axis('off') axis([-0.5 xmax+0.5 -0.5 ymax+0.5]); subplot(2,1,2) for i=1:m if(vol(i) > 0.001*tmax) th = tscale*vol(i); xgra(1)=xy(ijk(i,2)/2,1)+del(ijk(i,2)-1); ygra(1)=xy(ijk(i,2)/2,2)+del(ijk(i,2)); xgra(2)=xy(ijk(i,4)/2,1)+del(ijk(i,4)-1); ygra(2)=xy(ijk(i,4)/2,2)+del(ijk(i,4)); %plot(xgra,ygra,'b-','LineWidth',th); plot(xgra,ygra,'k-','LineWidth',th); hold on end end axis('equal') axis('off') axis([-0.5 xmax+0.5 -0.5 ymax+0.5]);