Frame
Frame
function [k,F,du,dF]=frame(X,Y,U,E,I,A,itask) % % MATLAB subroutine to conduct the computations for a frame member % % % X: abscissas of the member end points % y: ordinates of the member end points % U: member end displacement vector in global coordinate system % (it is only used if itask = 2, see below) % E: Young's modulus % I: Cross-sectional moment of inertia % A: Cross-sectional area % % itask: integer parameter, which determines what task must be conducted: % % if itask = 1, the routine calculates and returns the member % stiffness matrix in the global coordinate system, k. % % if itask = 2, the routine calculates and returns the member % end force vector in the global coordinate system, F, the element % basic deformation, du, and the element basic force, dF % %-------------------------------------------------------------------------% % FIRST, CONDUCT THE COMPUTATIONS WHICH ARE ALWAYS REQUIRED, NO MATTER WHAT THE VALUE OF itask IS!
dX=X(2)-X(1); dY=Y(2)-Y(1); L=(dX^2+dY^2)^0.5; cosp=dX/L; sinp=dY/L; % % % % % % % Determine the Gama array, with Gama=Gama-rbm*Gama-rot One could simply calculare Gama-rbm and Gama-rot and then multiply them, but this would be computationally expensive. To avoid this, we calculate BY HAND the values of Gama as a function of cosp, sinp and L. In this fashion we keep the required number of calculations to a minimum the (3x6) matrix Gama is found to be (VERIFY!):
val2=sinp/L; val1=cosp/L; Gama=[-val2 val1 1 val2 -val1 0;-val2 val1 0 val2 -val1 1;-cosp -sinp 0 cosp sinp 0]; % determine basic stiffness matrix: k1=2*E*I/L; kb=[2*k1 k1 0;k1 2*k1 0;0 0 E*A/L]; % basic stiffness!
if itask == 1
-1-
C:\Users\John\Documents\MATLAB\frame.m
% CONDUCT COMPUTATIONS IF itask =1: k = Gama'*kb*Gama; F=[0;0;0;0;0;0]; du=[0;0;0]; dF=[0;0;0]; elseif itask == 2 % CONDUCT COMPUTATIONS IF itask =2:
else % if itask is NOT equal to 1 or 2, print an error message: k = zeros(0); F=zeros(0); du=zeros(0); dF=zeros(0); disp('ERROR: unacceptable value of itask given, set itask to 1 or 2' ) end
end
-2-