Page 5 - Demo
P. 5


                                    Planar Truss Example for Comrel Add-on RCP Consult, 2021-2025 Page 5 % Plot frame axis equal axis([-2 26 -2 10]); grid minor % Set a main subtitle of plot text(12.0, 8.0, 'Internal member forces [N]', 'FontSize', 16, 'HorizontalAlignment', 'center'); % Plot internal member force N for e = 1:nfe l=leng(e)/2; n=abs(N(e))*0.0000005; X=[-l l l -l]; Y=[-n -n n n]; c = cosd(theta(e)); s = sind(theta(e)); Xrot = X*c - Y*s; Yrot = X*s + Y*c; x=(XY(IEN(e,1),1)+XY(IEN(e,2),1))/2; y=(XY(IEN(e,1),2)+XY(IEN(e,2),2))/2; if(N(e) >= 0) co=[1.0 0.6 0.5]; else co=[0.5 0.6 1.0]; end fill(Xrot + x, Yrot + y, co); text(x, y, sprintf('%0.1f N', N(e)), 'FontSize', 7, 'HorizontalAlignment', 'center'); end case 3 % Center plot for internal member Tensile stress f3=figure('Name', tit, 'NumberTitle','off','Position', [pxl(3)/4 pxl(4)/4 pxl(3)/2 pxl(4)/2]); figure(f3); hold on box on view(2) % Plot frame axis equal axis([-2 26 -2 10]); grid minor % Set a main subtitle of plot text(12.0, 8.0, 'Internal member von Mises stress \\sigma_{v} [MPa]', 'FontSize', 16, 'HorizontalAlignment', 'center'); % Plot for internal member von Mises stress cmap=jet(21); % prepare color mapping minA=min(abs(N'./Area*1e-6)); maxA=max(abs(N'./Area*1e-6)); ddA=maxA-minA; dA=ddA/20; for e = 1:nfe Su=abs(N(e)/Area(e)*1e-6); l=leng(e)/2 ; n=Su/ddA*0.2; % height of rectangle X=[-l l l -l]; Y=[-n -n n n]; c = cosd(theta(e)); s = sind(theta(e)); Xrot = X*c - Y*s; Yrot = X*s + Y*c; x=(XY(IEN(e,1),1)+XY(IEN(e,2),1))/2; y=(XY(IEN(e,1),2)+XY(IEN(e,2),2))/2; nc=int32((Su-minA)/dA-0.01)+1; co=cmap(nc,:); % color fill(Xrot + x, Yrot + y, co, 'EdgeColor', 'none', 'FaceAlpha', 0.7); text(x, y, sprintf('%.0f', Su), 'FontSize', 7, 'HorizontalAlignment', 'center'); end % Color bar colormap jet; colorbar(); clim([minA maxA]); end %% Do rest for all plots title(strcat('\\fontsize{18}',tit)); % Plot values of input data text(22, 5.5, sprintf('A1=%g m^2',A1), 'FontSize', 8); text(22, 5.2, sprintf('A2=%g m^2',A2), 'FontSize', 8); text(22, 4.9, sprintf('E1=%g N/m^2',E1), 'FontSize', 8); text(22, 4.6, sprintf('E2=%g N/m^2',E2), 'FontSize', 8); % Plot a main subtitle of plot text(-1.0, 5.5, sprintf('%s %s %s', StrurelName, StrurelModule, StrurelVersion), 'FontSize', 12); switch(StrurelMode) case 0 text(-1.0, 5.0, 'State at Mean Values', 'FontSize', 10); % input data at state of mean values case 2 text(-1.0, 5.0, sprintf('%s, %s', StrurelIMET, StrurelIOPT), 'FontSize', 10); % input data at beta-point end switch(StrurelMode) case 2 %% Stochastic Solution text(-1.0, 4.5, sprintf('beta=%g, Pf=%g', StrurelBeta, StrurelPf), 'FontSize', 10); % calculated beta and Pf end text(-1.9, -1.8, StrurelEngine, 'FontSize', 8) % invoked version of engine end end end % end of plot blockend % end of function
                                
   1   2   3   4   5   6   7   8   9   10