clc; clear all; fileID = fopen('output.html','w'); % mdof system % n=input('No of Floor:'); n=4; m=[8,8,4,4]; mcomp=m/max(m); k=[1000,800,600,600]; k(1,n+1)=0; massm =zeros(n); stiffm=zeros(n,n); for i=1:n massm(i,idinv*c)=m(1,i); end for i=1:n-1 ktempm(1,1,i)= k(1,i+1); ktempm(1,2,i)= -k(1,i+1); ktempm(2,1,i)= -k(1,i+1); ktempm(2,2,i)= k(1,i+1); end for f=1:n-1 for i=1:2 for j=1:2 stiffm(i+f-1,j+f-1)=stiffm(i+f-1,j+f-1)+ ktempm(i,j,f); end end end stiffm(1,1)= stiffm(1,1)+k(1,1); mink=inv(massm)*stiffm; [v,d]=eig(mink); [dd]=eig(mink); x=0:3:n*3; vtemp=zeros(n+1,n); for i=1:n for j=1:n vtemp(i+1,j)=v(i,j); end end colx=[0,n*3]; coly=[0,0]; % plot(vtemp(:,1),x); hold on % plot(coly,colx); hold off tempfloor=zeros(n+1,1,n); for j=1:n+1 for i=1:n tempfloor(j,1,i)=vtemp(j,i)+0; end end xtemp=x+3; % plot(tempfloor(:,1,2),x(1,:)); % plot(tempfloor(:,1,2),xtemp(1,:)); for i=1:n hold on grid on grid minor y=tempfloor(:,1,i); xi=0:0.1:3*n; yi=pchip(x,y,xi); plot(tempfloor(:,1,i),x,'o'); plot(tempfloor(:,1,i)+3,x,'o'); plot(yi,xi,'Linewidth',1,'MarkerFaceColor',[.90 .90 .90]); plot(yi+3,xi,'Linewidth',1,'MarkerFaceColor',[.90 .90 .90]); plot(coly,colx,'--'); plot(coly+3,colx,'--'); for s=1:n tempoo1=[x(s+1),x(s+1)]; tempoo2=[y(s+1),y(s+1)+3]; pp=(mcomp(s)); plot(tempoo2,tempoo1,'Linewidth',pp*7,'MarkerSize',1,'MarkerFace',[.9292 .6940 .1250]); end hold off xlim([-3 6]); name=sprintf('%d.png',i); saveas(gcf,name); close(); end % output file printing fprintf(fileID,'\n'); fprintf(fileID,'\n'); fprintf(fileID,'\n'); fprintf(fileID,'\n'); fprintf(fileID,'

Multipal Degree of Freedom (MDOF)(Free Undamped)

\n'); fprintf(fileID,'
\n'); % Input details fprintf(fileID,'

Input Detail:

\n'); fprintf(fileID,'\n'); fprintf(fileID,',',n); fprintf(fileID,'
No. of Floors:%d
'); fprintf(fileID,'\n'); fprintf(fileID,''); for i=1:n fprintf(fileID,'\n',m(1,i)); end fprintf(fileID,''); fprintf(fileID,''); for i=1:n fprintf(fileID,'\n',k(1,i)); end fprintf(fileID,''); fprintf(fileID,'
Mass(kg):%.2f
Stiffness(N/m):%f
'); fprintf(fileID,'

Output Details:

\n'); fprintf(fileID,'\n'); fprintf(fileID,'Mass Matrix:'); for i=1:n fprintf(fileID,''); for j=1:n fprintf(fileID,'\n',massm(i,j)); end fprintf(fileID,''); end fprintf(fileID,'
%.3f
'); fprintf(fileID,'
'); fprintf(fileID,'\n'); fprintf(fileID,'Stiffness Matrix:'); for i=1:n fprintf(fileID,''); for j=1:n fprintf(fileID,'\n',stiffm(i,j)); end fprintf(fileID,''); end fprintf(fileID,'
%.2f
'); fprintf(fileID,'
'); fprintf(fileID,'\n'); fprintf(fileID,'Omega:(rad/s)'); for i=1:n fprintf(fileID,''); for j=1:n fprintf(fileID,'\n',sqrt(d(i,j))); end fprintf(fileID,''); end fprintf(fileID,'
%.3f
'); fprintf(fileID,'
'); fprintf(fileID,'\n'); fprintf(fileID,'Φ funcations:'); for i=1:n fprintf(fileID,''); for j=1:n fprintf(fileID,'\n',v(i,j)); end fprintf(fileID,''); end fprintf(fileID,'
%.3f
'); fprintf(fileID,'
'); fprintf(fileID,'
'); fprintf(fileID,'\n'); for i=1:n fprintf(fileID,'',sqrt(d(i,i))); fprintf(fileID,'',i); fprintf(fileID,''); end fprintf(fileID,'
ω = %0.3f rad/s
  
');