%% pos_processing % % This function performs post-processing tasks to provide the analysis results. % % It is recommended that any contribution to the code be documented through comments in the History section. % %% Function % Input: % Model: data structure with model information % Node: vector of data structures with node infromation % Elem: vector of data structures with element infromation % Result: data structures with result information (vector of load ratio and displacements) % plot_type: type of result to plot % res_type: type of result to plot in equilibrium path % nid: node id for ploting equilibrium path % d: node DOF for ploting equilibrium path % function pos_processing(Model,Node,Elem,Result,plot_type,res_type,nid,d) flags_pos % Plot equilibrium path if (plot_type == PLOT_GRAPH || plot_type == PLOT_BOTH) % Check if figure exists and make it current figure if (isempty(findall(0,'type','figure','name','graph'))) figure('Name','graph'); else set(0, 'CurrentFigure', findall(0,'type','figure','name','graph')) end % 2D plot if (size(nid,2) == 1 && size(d,2) == 1) % Step results if (res_type == RES_STEPS || res_type == RES_BOTH) plot(Result.U_step(Node(nid).dof(d),:),Result.lr_step); hold on end % Iteration results if (res_type == RES_ITER || res_type == RES_BOTH) plot(Result.U_iter(Node(nid).dof(d),:),Result.lr_iter,'Marker','x','MarkerSize',3); hold on end grid on legend; xlabel('Displacement') ylabel('Load Ratio') % 3D plot elseif (size(nid,2) > 1 && size(d,2) > 1) % Step results if (res_type == RES_STEPS || res_type == RES_BOTH) plot3(Result.U_step(Node(nid(1)).dof(d(1)),:),Result.U_step(Node(nid(2)).dof(d(2)),:),Result.lr_step); hold on end % Iteration results if (res_type == RES_ITER || res_type == RES_BOTH) plot(Result.U_iter(Node(nid(1)).dof(d(1)),:),Result.U_iter(Node(nid(2)).dof(d(2)),:),Result.lr_iter,'Marker','x','MarkerSize',3); hold on end grid on legend; xlabel('Displacement 1') ylabel('Displacement 2') zlabel('Load Ratio') end end % Draw structure (initial and deformed configurations) if (plot_type == PLOT_MODEL || plot_type == PLOT_BOTH) % Check if figure exists and make it current figure if (isempty(findall(0,'type','figure','name','model'))) figure('Name','model'); else set(0, 'CurrentFigure', findall(0,'type','figure','name','model')) end for i = 1:Model.nel % Initial configuration x1 = Elem(i).n1.x; y1 = Elem(i).n1.y; x2 = Elem(i).n2.x; y2 = Elem(i).n2.y; x = [x1 x2]; y = [y1 y2]; scatter(x,y,15,'filled','black'); hold on plot(x,y,'black'); hold on % Deformed configuration col = size(Result.U_step,2); x1 = Elem(i).n1.x + Result.U_step(Elem(i).n1.dof(1),col); y1 = Elem(i).n1.y + Result.U_step(Elem(i).n1.dof(2),col); x2 = Elem(i).n2.x + Result.U_step(Elem(i).n2.dof(1),col); y2 = Elem(i).n2.y + Result.U_step(Elem(i).n2.dof(2),col); x = [x1 x2]; y = [y1 y2]; scatter(x,y,15,'filled','black'); hold on plot(x,y,'black'); hold on end grid off axis equal % Adjust limits xLimits = get(gca,'XLim'); yLimits = get(gca,'YLim'); gapX = (xLimits(2)-xLimits(1))/10; gapY = (yLimits(2)-yLimits(1))/10; minX = xLimits(1) - gapX; maxX = xLimits(2) + gapX; minY = yLimits(1) - gapY; maxY = yLimits(2) + gapY; xlim([minX maxX]) ylim([minY maxY]) end end