{"id":1234,"date":"2020-05-13T06:05:54","date_gmt":"2020-05-13T06:05:54","guid":{"rendered":"https:\/\/people.utm.my\/arazin\/?p=1234"},"modified":"2020-05-13T07:03:02","modified_gmt":"2020-05-13T07:03:02","slug":"plotting-deformation-of-frame-structure-fem","status":"publish","type":"post","link":"https:\/\/people.utm.my\/arazin\/2020\/05\/13\/plotting-deformation-of-frame-structure-fem\/","title":{"rendered":"Plotting deformation of frame structure (FEM)"},"content":{"rendered":"<h4 style=\"text-align: right\"><span style=\"color: #800000\">This is a MATLAB code to plot a deformation of planar frame structure.<\/span><\/h4>\n<h4 style=\"text-align: right\"><span style=\"color: #800000\">Since the formulation involves transformation of local elements to a global system,<\/span><\/h4>\n<h4 style=\"text-align: right\"><span style=\"color: #800000\">plotting using a simple w(x) versus x is not possible..<\/span><\/h4>\n<h4 style=\"text-align: right\"><span style=\"color: #800000\">We need to transform back the DOFs obtained in the global system to the local system,<\/span><\/h4>\n<h4 style=\"text-align: right\"><span style=\"color: #800000\">and plot in a local system and then simply &#8216;move &amp; rotate&#8217; it to suit the global position..<\/span><\/h4>\n<h4 style=\"text-align: right\"><span style=\"color: #800000\">For example:<\/span><\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1237 alignright\" src=\"https:\/\/people.utm.my\/arazin\/wp-content\/uploads\/sites\/595\/2020\/05\/Frame1-300x181.png\" alt=\"\" width=\"300\" height=\"181\" \/><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<blockquote>\n<pre><span style=\"color: #000000\">clear\r\nclc\r\n\r\n<span style=\"color: #99cc00\">% INPUT<\/span> \r\nPoints = [0 0; 5 0; 8 -6];        <span style=\"color: #99cc00\">%Nodes<\/span>\r\nCn = [1 2; 2 3];                  <span style=\"color: #99cc00\">%connectivity matrix<\/span>\r\nne = length(Cn);                  <span style=\"color: #99cc00\">%no.of elements<\/span>\r\nU = [0 0 0 0 0 -0.8 1.5 0 0.7]'; <span style=\"color: #99cc00\"> %deformation in global system<\/span>\r\n\r\n<span style=\"color: #99cc00\">% PLOTTING<\/span>\r\nclf\r\nhold on\r\n\r\n<span style=\"color: #99cc00\">% Simple plot for intial &amp; deformed shapes\r\n<\/span>Uplot = U; Uplot(3:3:end) = [];\r\nNewPoints = Points + reshape(Uplot,size(Points'))';\r\nfor i = 1:ne\r\n    plot(Points(Cn(i,:),1), ...\r\n        Points(Cn(i,:),2),'bo--')   <span style=\"color: #99cc00\">  %initial<\/span>\r\n    plot(NewPoints(Cn(i,:),1),...\r\n        NewPoints(Cn(i,:),2),'go-.')  <span style=\"color: #99cc00\">%deformed<\/span>\r\nend\r\n\r\nfor i = 1:ne\r\n    \r\n<span style=\"color: #99cc00\">    % Length of element \r\n<\/span>    X = Points(Cn(i,2),1)-Points(Cn(i,1),1);\r\n    Y = Points(Cn(i,2),2)-Points(Cn(i,1),2);\r\n    L = sqrt(X^2+Y^2);\r\n    \r\n<span style=\"color: #99cc00\">    % Angle &amp; transformation matrix\r\n<\/span>    B = atand(Y\/X);\r\n    c = cosd(B);\r\n    s = sind(B);\r\n    T = [c s 0 0 0 0; -s c 0 0 0 0;\r\n        0 0 1 0 0 0; 0 0 0 c s 0;\r\n        0 0 0 -s c 0; 0 0 0 0 0 1];\r\n    \r\n<span style=\"color: #99cc00\">    % Index number in the global system\r\n<\/span>    index = [3*Cn(i,1)-2:3*Cn(i,1)...\r\n        3*Cn(i,2)-2:3*Cn(i,2)];\r\n    \r\n    u = T*U(index);  <span style=\"color: #99cc00\">%local dofs<\/span>\r\n    x = 0:L\/20:L;    <span style=\"color: #99cc00\">%original local axis<\/span>\r\n    \r\n<span style=\"color: #99cc00\">    % local horizontal displacements function, u(x)\r\n<\/span>    N1bar = 1-x\/L;\r\n    N2bar = x\/L;\r\n    xx = x + N1bar*u(1) + N2bar*u(4);\r\n    \r\n<span style=\"color: #99cc00\">    % local vertical displacements function, w(x)\r\n<\/span>    N1beam = -3*x.^2\/L^2 + 1 + 2*x.^3\/L^3;\r\n    N2beam = -2*x.^2\/L + x + x.^3\/L^2;\r\n    N3beam = 3*x.^2\/L^2 - 2*x.^3\/L^3;\r\n    N4beam = -x.^2\/L + x.^3\/L^2;\r\n    yy = N1beam*u(2) + N2beam*u(3) + N3beam*u(5) + N4beam*u(6);\r\n\r\n<span style=\"color: #99cc00\">    % adjustment to the global axis (move the origin + rotate)\r\n<\/span>    xr = Points(Cn(i,1),1) + xx*cosd(B) - yy*sind(B);\r\n    yr = Points(Cn(i,1),2) + xx*sind(B) + yy*cosd(B);\r\n\r\n    %plot(xx,yy,'c-') <span style=\"color: #99cc00\">%plot at local axis (to check)<\/span>\r\n    plot(xr,yr,'k-','LineWidth',3)  <span style=\"color: #99cc00\">%plot at global axis<\/span>  \r\n    \r\nend\r\nhold off\r\naxis equal<\/span><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This is a MATLAB code to plot a deformation of planar frame structure. Since the formulation involves transformation of local elements to a global system, plotting using a simple w(x) versus x is not possible.. We need to transform back the DOFs obtained in the global system to the local system, and plot in a [&hellip;]<\/p>\n","protected":false},"author":6455,"featured_media":1237,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[6,7],"tags":[],"class_list":["post-1234","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fem","category-matlab"],"_links":{"self":[{"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/posts\/1234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/users\/6455"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/comments?post=1234"}],"version-history":[{"count":10,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/posts\/1234\/revisions"}],"predecessor-version":[{"id":1245,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/posts\/1234\/revisions\/1245"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/media\/1237"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/media?parent=1234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/categories?post=1234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/arazin\/wp-json\/wp\/v2\/tags?post=1234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}