def rigidmaty(s,params): """Return the 4x4 transfer matrix for motion of a rigid mass about its y-axis.""" L = get_first_key_that_exists(params, ['Ly','L']) r = get_first_key_that_exists(params, ['ry','r']) Imat = get_first_key_that_exists(params, ['Iy','I']) m=params['m'] if shape(Imat): if max(shape(Imat))>=1: Iy=Imat[1] else: Iy=Imat[0] else: Iy=Imat #this matrix assumes +w_z is the state [w_z; theta_y; M_y; V_z] and is derived in #Rmatrix_3D.m in E:\GT\Research\SAmii\modeling\transfer_matrix\threeD_TMM_derivations # [ 1, -L, 0, 0] # [ 0, 1, 0, 0] # [ m*s^2*(L-r), s^2*Iz-m*s^2*r*(L-r), 1, L] # [ m*s^2, -m*s^2*r, 0, 1] matout=array([[1.,-L,0,0],[0,1.,0,0],[m*s**2*(L-r),s**2*Iy-m*s**2*r*(L-r),1.,L],[m*s**2,-m*s**2*r,0,1.]]) return matout
def rigidmatz(s,params): """Return the 4x4 transfer matrix for motion of a rigid mass about its z-axis.""" L = get_first_key_that_exists(params, ['Lz','L']) r = get_first_key_that_exists(params, ['rz','r']) Imat = get_first_key_that_exists(params, ['Iz','I']) m=params['m'] if shape(Imat): Iz=Imat[2] else: Iz=Imat #this matrix assumes +w_y is the state [w_y; theta_z; M_z; V_y] and is derived in #Rmatrix_3D.m in E:\GT\Research\SAmii\modeling\transfer_matrix\threeD_TMM_derivations # [ 1, L, 0, 0] # [ 0, 1, 0, 0] # [ -m*s^2*(L-r), s^2*Iz-m*s^2*r*(L-r), 1, -L] # [ m*s^2, m*s^2*r, 0, 1] matout=array([[1.,L,0,0],\ [0,1.,0,0],\ [-m*s**2*(L-r),s**2*Iz-m*s**2*r*(L-r),1.,-L],\ [m*s**2,m*s**2*r,0,1.]]) return matout