import numpy as np
x=[ 2061075.875, 2061801, 2061154.25, 2061605.75, 2061314.375]
y=[ 10638640, 10639060, 10638727, 10639118, 10638802]
st=[ 73.92976, 71.13528, 64.40809, 71.80971, 72.72918]
l=[ 254.96384, 239.15473, 200.20001, 218.91659, 185.49989]
deltaL=10
N=np.floor(np.divide(l,deltaL))
for i in range(0,len(x)):
if (int(N[i]/2)==N[i]/2):
px_down = np.zeros((len(x),max(np.floor(N/2))))
py_down = np.zeros((len(x),max(np.floor(N/2))))
for j in range(0,int(N[i]/2)):
px_down[i,j]=x[i]-(deltaL*j)*np.sin(st[i]*np.pi/180)
py_down[i,j]=y[i]-(deltaL*j)*np.cos(st[i]*np.pi/180)
else:
px_down = np.zeros((len(x),max(np.floor(N/2))))
py_down = np.zeros((len(x),max(np.floor(N/2))))
for j in range(0,int((N[i]-1)/2)):
px_down[i,j]=x[i]-(deltaL*j)*np.sin(st[i]*np.pi/180)
py_down[i,j]=y[i]-(deltaL*j)*np.cos(st[i]*np.pi/180)
px_down和y_down的结果很奇怪,在这两个矩阵中有很多零。但是使用MATLAB,我们得到了:
2061066.26576935 2061056.65653871 2061047.04730806 2061037.43807742 2061027.82884677 2061018.21961613 2061008.61038548 2060999.00115484 2060989.39192419 2060979.78269355 2060970.17346290 2060960.56423225
2061791.53715368 2061782.07430735 2061772.61146103 2061763.14861471 2061753.68576838 2061744.22292206 2061734.76007574 2061725.29722942 2061715.83438309 2061706.37153677 2061696.90869045 0
2061145.23106473 2061136.21212947 2061127.19319420 2061118.17425893 2061109.15532367 2061100.13638840 2061091.11745313 2061082.09851787 2061073.07958260 2061064.06064733 0 0
2061596.24975030 2061586.74950061 2061577.24925091 2061567.74900121 2061558.24875151 2061548.74850182 2061539.24825212 2061529.74800242 2061520.24775272 2061510.74750303 0 0
2061304.82587875 2061295.27675750 2061285.72763625 2061276.17851501 2061266.62939376 2061257.08027251 2061247.53115126 2061237.98203001 2061228.43290876 0 0 0
有没有人有解决这个问题的想法?非常感谢你的帮助!!!
答案 0 :(得分:0)
你覆盖你的基质。试试这个:
import numpy as np
x=[ 2061075.875, 2061801, 2061154.25, 2061605.75, 2061314.375]
y=[ 10638640, 10639060, 10638727, 10639118, 10638802]
st=[ 73.92976, 71.13528, 64.40809, 71.80971, 72.72918]
l=[ 254.96384, 239.15473, 200.20001, 218.91659, 185.49989]
deltaL=10
N=np.floor(np.divide(l,deltaL))
px_down = np.zeros((len(x),max(np.floor(N/2))))
py_down = np.zeros((len(x),max(np.floor(N/2))))
for i in range(0,len(x)):
if (int(N[i]/2)==N[i]/2):
for j in range(0,int(N[i]/2)):
px_down[i,j]=x[i]-(deltaL*j)*np.sin(st[i]*np.pi/180)
py_down[i,j]=y[i]-(deltaL*j)*np.cos(st[i]*np.pi/180)
else:
for j in range(0,int((N[i]-1)/2)):
px_down[i,j]=x[i]-(deltaL*j)*np.sin(st[i]*np.pi/180)
py_down[i,j]=y[i]-(deltaL*j)*np.cos(st[i]*np.pi/180)