畫四元數曲線圖

#!/usr/bin/python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np

f=open("./aa","r")
lines=f.readlines()
resultw=[]
resultx=[]
resulty=[]
resultz=[]

for x in lines:
    resultx.append(float(x.split(' ')[0]))
    resulty.append(float(x.split(' ')[1]))
    resultz.append(float(x.split(' ')[2]))
    resultw.append(float(x.split(' ')[3]))
f.close()

resultw = [float(i) for i in resultw]
resultx = [float(i) for i in resultx]
resulty = [float(i) for i in resulty]
resultz = [float(i) for i in resultz]

plt.plot(resultx)
plt.plot(resulty)
plt.plot(resultz)
plt.plot(resultw)
plt.legend(['x','y','z','w'])
plt.show()
0.02155 -0.16142 -0.28514 0.94455
-0.04183 -0.01969 -0.27431 0.96053
-0.04165 -0.01729 -0.27285 0.96100
-0.04177 -0.01576 -0.27085 0.96159
-0.04128 -0.01509 -0.26977 0.96192
-0.04083 -0.01446 -0.26843 0.96233
-0.04046 -0.01409 -0.26763 0.96257
-0.04003 -0.01386 -0.26762 0.96259
-0.03972 -0.01366 -0.26865 0.96232
-0.03946 -0.01352 -0.26948 0.96210
-0.03888 -0.01323 -0.27045 0.96186
-0.03858 -0.01312 -0.27084 0.96176
-0.03831 -0.01306 -0.27118 0.96168
-0.03801 -0.01300 -0.27149 0.96160
-0.03786 -0.01301 -0.27175 0.96153
-0.03763 -0.01300 -0.27206 0.96146
-0.03745 -0.01297 -0.27220 0.96143
-0.03709 -0.01286 -0.27238 0.96139
-0.03680 -0.01278 -0.27254 0.96135
-0.03665 -0.01279 -0.27269 0.96132
-0.03651 -0.01278 -0.27282 0.96129
-0.03623 -0.01275 -0.27295 0.96126
-0.03603 -0.01270 -0.27304 0.96125
-0.03598 -0.01270 -0.27317 0.96121
-0.03580 -0.01266 -0.27329 0.96118
-0.03576 -0.01265 -0.27338 0.96116
-0.03564 -0.01260 -0.27346 0.96114
-0.03545 -0.01255 -0.27361 0.96110
-0.03518 -0.01248 -0.27373 0.96108
-0.03499 -0.01245 -0.27380 0.96107
-0.03485 -0.01235 -0.27440 0.96091
-0.03454 -0.01224 -0.27516 0.96070
-0.03437 -0.01217 -0.27585 0.96051
-0.03414 -0.01211 -0.27647 0.96034
-0.03393 -0.01200 -0.27703 0.96019
-0.03418 -0.01188 -0.27721 0.96013
-0.03365 -0.01191 -0.27785 0.95996
-0.03340 -0.01185 -0.27828 0.95984
-0.03309 -0.01172 -0.27868 0.95974
-0.03299 -0.01170 -0.27881 0.95971
-0.03251 -0.01151 -0.27927 0.95959
-0.03228 -0.01143 -0.27954 0.95952
-0.03222 -0.01142 -0.27964 0.95950
-0.03182 -0.01130 -0.28002 0.95940
-0.03158 -0.01123 -0.28028 0.95933
-0.03144 -0.01154 -0.28050 0.95927
-0.03114 -0.01158 -0.28068 0.95922
-0.03096 -0.01126 -0.28076 0.95921
-0.03076 -0.01150 -0.28053 0.95928
-0.03068 -0.01151 -0.28046 0.95931
-0.03019 -0.01119 -0.28024 0.95939
-0.02995 -0.01111 -0.28011 0.95944
-0.02975 -0.01106 -0.27988 0.95951
-0.02961 -0.01105 -0.27862 0.95988
-0.02943 -0.01102 -0.27790 0.96010
-0.02917 -0.01095 -0.27693 0.96038
-0.02901 -0.01089 -0.27602 0.96065
-0.02878 -0.01082 -0.27520 0.96090
-0.02860 -0.01077 -0.27475 0.96103
-0.02850 -0.01074 -0.27430 0.96116
-0.02847 -0.01073 -0.27417 0.96120
-0.02841 -0.01070 -0.27406 0.96123
-0.02829 -0.01064 -0.27359 0.96137
-0.02809 -0.01056 -0.27393 0.96128
-0.02802 -0.01053 -0.27413 0.96123
-0.02777 -0.01043 -0.27448 0.96114
-0.02755 -0.01032 -0.27437 0.96117
-0.02726 -0.01015 -0.27489 0.96103

书籍推荐