%************************************************************************** % Plot malha2Mat: Plota a malha de elementos finitos a partir dos nos e conectividade % % numbering == 1: Plota a malha em preto com os nós e elementos % 0: Plota a malha em preto somente % % inci(numero, tipo, tmat, tgeo, no1, no2 ,...) % coord( x1,y1; x2,y2 ; ...) % % Author: Renato Pavanello % Copyright (c) 2023 by The DMC/FEM/UNICAMP. %************************************************************************** function plotMalha2Mat(coord,inci,index,tit,Tgeo,Tmat,Lsize) nel=length(inci(:,1)); %numero de elementos nnos=length(coord(:,1)); %numero de nós vnos=[1:nnos]'; nnel=size(inci(:,5:end),2); %Numero de nos por elemento dimension=size(coord,2); %Dimensao da malha %% ********* Initializacao das matrices ******************* X = zeros(nnel,nel) ; Y = zeros(nnel,nel) ; if dimension==2 %For 2D plots for iel=1:nel for i=1:nnel X(i,iel)=coord(inci(iel,i+4),1); Y(i,iel)=coord(inci(iel,i+4),2); end end switch index case 0 %Plotting the FEM mesh for i =1:nel if inci(i,3) ==1 cor=[ 0.4431 , 0.4745 , 0.4941]; else cor=[ 0.8667 , 0.5412 , 0.2353]; end Ar=Lsize*Tgeo(i)/max(Tgeo); plot(X(:,i),Y(:,i),'LineWidth',Ar,'Color',cor) ;hold on; end title(tit) ; % fill(X,Y,'w') % Preenche os elementos de branco para ficar mais visivel axis off axis equal hold off; %line(x,y,'Color',[ 0.8667 , 0.5412 , 0.2353],'LineWidth',25) %line for timber %line(x,y,'Color',[ 0.4431 , 0.4745 , 0.4941],'LineWidth',25) % line for steel case 1 % Plotting the FEM mesh, display Node numbers and Element numbers for i =1:nel if inci(i,3) ==1 cor=[ 0.4431 , 0.4745 , 0.4941]; else cor=[ 0.8667 , 0.5412 , 0.2353]; end Ar=Lsize*Tgeo(i)/max(Tgeo); plot(X(:,i),Y(:,i),'LineWidth',Ar,'Color',cor) ;hold on; end title(tit) ; % fill(X,Y,'w') % Preenche os elementos de branco para ficar mais visivel axis off axis equal % Numeracao text(coord(:,1),coord(:,2),int2str(vnos(:,1)),'fontsize',8,'color','k'); for i = 1:nel text(sum(X(:,i))/2,sum(Y(:,i))/2,int2str(i),'fontsize',10,'color','r'); end otherwise disp('Unknown method in PlotMalha.') end end end