I was wondering if anyone could help me out with this:
lets say u have three arrays:
A=[1,2,3,4]
B=[2,3,4,5]
C=[4,6,7,8]
I want to use each column from each array to get an output, such that when the code runs it uses the first column, then on the second run uses the second column..e.t.c
here is the code I have been trying to work on, I have tired different methods but none have worked for me
according to my code the first column of array from my code i.e xfrn, theta_freqrn, kappa_freqrn, arn and mthetadot, will give a single value of vf, and when the process is repeated it uses the second column of the array from each array to get another vf e.t.c.
lets say u have three arrays:
A=[1,2,3,4]
B=[2,3,4,5]
C=[4,6,7,8]
I want to use each column from each array to get an output, such that when the code runs it uses the first column, then on the second run uses the second column..e.t.c
here is the code I have been trying to work on, I have tired different methods but none have worked for me
according to my code the first column of array from my code i.e xfrn, theta_freqrn, kappa_freqrn, arn and mthetadot, will give a single value of vf, and when the process is repeated it uses the second column of the array from each array to get another vf e.t.c.
Code:
xfrn=array([0.937143,0.885173,1.0329])
theta_freqrn= array([10.1579,9.99248,10.9348])
kappa_freqrn= array([4.95614, 4, 2])
arn = array([6.32918, 5, 2])
Mthetadotrn= array([-1.15940, 1, 4])
s = 7.5
c = 2.0
m = 100.0
rho = 1.225
xcm = 0.5*c
e = xfrn/c-0.25
vel = zeros((3500,1),float)
freq1 = zeros((3500,1),float)
freq2 = zeros((3500,1),float)
freq3 = zeros((3500,1),float)
freq4 = zeros((3500,1),float)
damp1 = zeros((3500,1),float)
damp2 = zeros((3500,1),float)
damp3 = zeros((3500,1),float)
damp4 = zeros((3500,1),float)
vstart = 1.0
vinc = 0.1 for icount in range(3500):
V=vstart + icount*vinc
a11 = (m*s*s*s*c)/3.0
a12 = m*s*s*(c*c/2.0-c*xfrn)/2.0
a21 = a12
a22 = m*s*(c*c*c/3.0-c*c*xfrn+xfrn*xfrn*c)
A = matrix([[a11,a12],[a21,a22]])
Ainv = linalg.inv(A)
k1 = ((kappa_freqrn*arn)**2)*a11
k2 = ((theta_freqrn*arn)**2)*a22
c11 = (rho*V*c*s*s*s*arn)/6.0
c12 = 0
c21 = -(rho*V*c*c*s*s*e*arn)/4.0
c22 = -(rho*V*c*c*c*s*Mthetadotrn)/8.0
C = matrix([[c11,c12],[c21,c22]])
AC = -Ainv*C
k11 = k1
k12 = (rho*V*V*c*s*s*arn)/4.0
k21 = 0
k22 = k2 - (rho*V*V*c*c*s*e*arn)/2.0
K = matrix([[k11,k12],[k21,k22]])
AK = -Ainv*K
matrix_bind_columns = concatenate((AK,AC),axis=1)
M = concatenate((matrix([[0.0,0.0,1.0,0.0][0.0,0.0,0.0,1.0]]),matrix_bind_columns),axis=0)
Meig = linalg.eig(M)[0]
vel[icount] = V
freq1[icount] = abs(Meig[0])
damp1[icount] = -100.0*real(Meig[0])/freq1[icount]
freq1[icount] = freq1[icount]/2*math.pi
freq2[icount] = abs(Meig[1])
damp2[icount] = -100.0*real(Meig[1])/freq2[icount]
freq2[icount] = freq2[icount]/2*math.pi
freq3[icount] = abs(Meig[2])
damp3[icount] = -100.0*real(Meig[2])/freq3[icount]
freq3[icount] = freq3[icount]/2*math.pi
freq4[icount] = abs(Meig[3])
damp4[icount] = -100.0*real(Meig[3])/freq4[icount]
freq4[icount] = freq4[icount]/2*math.pi
if damp3[icount] < 0: goes below zero
break
ab = (damp3[icount-1])
bc = (damp3[icount])
Vf_min = V-0.1
Vf_max = V
def flutter_speed(ab,bc,Vf_min,Vf_max):
return (Vf_min+(Vf_max - Vf_min)*(-(ab)/(bc - ab)))
Vf = flutter_speed(ab,bc,Vf_min,Vf_max)
print Vf
Comment