forked from Mrunzzz/Advanced-Structural-Analysis-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMD_etran.m
62 lines (47 loc) · 1.86 KB
/
MD_etran.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function [gamma] = MD_etran (coordi, coordj, webdir)
% Code developed by Mrunmayi Mungekar and Devasmit Dutta
%
% MD_etran.m computes the element transformation matrix for a given element
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Functions Called
% none
%
% Dictionary of variables
% Input information
% coordi = 1st coordinate of given element in [x ;y ;z] form
% coordj = 2nd coordinate of given element in [x ;y ;z] form
% webdir = direction of the web for given element in vector form
%
% Output information
% gamma = final transformation matrix in 12 x 12 form
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define global coordinate directions
global_x = [1 ;0 ;0];
global_y = [0 ;1 ;0];
global_z = [0 ;0 ;1];
% Define local coordinate directions
local_x = coordj - coordi;
local_y = webdir;
% Define the angles between local and global axes
phixx = acos(dot(local_x,global_x)/(norm(local_x)*norm(global_x)));
phixy = acos(dot(local_x,global_y)/(norm(local_x)*norm(global_y)));
phixz = acos(dot(local_x,global_z)/(norm(local_x)*norm(global_z)));
phiyx = acos(dot(local_y,global_x)/(norm(local_y)*norm(global_x)));
phiyy = acos(dot(local_y,global_y)/(norm(local_y)*norm(global_y)));
phiyz = acos(dot(local_y,global_z)/(norm(local_y)*norm(global_z)));
% Evaluating the direction cosines
mat = [cos(phixx) cos(phixy) cos(phixz);
cos(phiyx) cos(phiyy) cos(phiyz)];
G = zeros(3,3);
G(1:2,:) = mat;
% Getting the direction cosine for the local Z direction
G(3,:) = cross(mat(1,:),mat(2,:));
% Consolidating the final gamma as 12 x 12 transformation matrix
gamma = [ G zeros(3,9);
zeros(3,3) G zeros(3,6);
zeros(3,6) G zeros(3,3);
zeros(3,9) G];