質問編集履歴

1

具体的なプログラムの表記

2020/06/30 08:11

投稿

ryusei_python
ryusei_python

スコア18

test CHANGED
File without changes
test CHANGED
@@ -1,9 +1,135 @@
1
1
  python初心者です.
2
2
 
3
- pythonで作図した時系列データに対し,最小二乗法を用いた曲線近似(対数近似 : y=a+b*INx)を求めたいと思っているのでが,うまくできません
3
+ pythonで作図した時系列データに対し,最小二乗法を用いた曲線近似(対数近似 : y=a+b*INx)を求めたいと思っていす.
4
+
5
+
6
+
7
+ scipy.optimize.curve_fit()を使おうと思ったのですが,私の力が足りずできませんでした.....
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ 以下に近似線を引く前のプログラムです.
18
+
19
+
20
+
21
+ N1 = np.genfromtxt\
22
+
23
+ (r_id_2020+'/' + date + '/' + 'sokudo'+ date+'/' + 'sokudo_001' +'_'+date+ kakutyo , \
24
+
25
+ delimiter= "," , skip_header=2, dtype='float')
26
+
27
+
28
+
29
+ T = N1[:,0]
30
+
31
+ x = N1[:,1]
32
+
33
+ y = N1[:,2]
34
+
35
+ Vx = N1[:,3]
36
+
37
+ Vy = N1[:,4]
38
+
39
+
40
+
41
+
42
+
43
+ plt.plot(x,Vx , c="red" ,linewidth = 3.0 ,linestyle = "--" ,label = "experiment")
44
+
45
+ plt.tight_layout()
46
+
47
+ plt.grid(True)
48
+
49
+ plt.legend(loc = 4,fontsize =18)
50
+
51
+ plt.xlim([0,100])
52
+
53
+ plt.ylim([0,200])
54
+
55
+ plt.show()
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ 以下に示すのが読み取った値です.
66
+
67
+
68
+
69
+ 横軸:x=[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
70
+
71
+ 0.00000000e+00 1.90961041e-02 5.24035548e-02 2.85298953e-01
72
+
73
+ 7.21075890e-01 1.27872008e+00 1.93054469e+00 2.74415196e+00
74
+
75
+ 3.68723589e+00 4.75847352e+00 5.87141905e+00 7.04011478e+00
76
+
77
+ 8.36277713e+00 9.70280669e+00 1.11143465e+01 1.25954020e+01
78
+
79
+ 1.41392145e+01 1.57012355e+01 1.73083533e+01 1.89795096e+01
80
+
81
+ 2.06446459e+01 2.24057242e+01 2.41901302e+01 2.60303676e+01
82
+
83
+ 2.78307003e+01 2.95976600e+01 3.13087960e+01 3.30842440e+01
84
+
85
+ 3.47851258e+01 3.65105431e+01 3.82488748e+01 4.00159721e+01
86
+
87
+ 4.17402677e+01 4.34410278e+01 4.52448555e+01 4.69817836e+01
88
+
89
+ 4.87180675e+01 5.04680193e+01 5.22016781e+01 5.39695510e+01
90
+
91
+ 5.56590214e+01 5.73945792e+01 5.92032241e+01 6.09687188e+01
92
+
93
+ 6.27228611e+01 6.45467608e+01 6.63263339e+01 6.81291919e+01
94
+
95
+ 6.99411467e+01 7.17997065e+01 7.36481266e+01 7.54604648e+01
96
+
97
+ 7.72207331e+01 7.90777275e+01 8.08353332e+01 8.26670779e+01
98
+
99
+ 8.46531627e+01]
100
+
101
+
102
+
103
+ 縦軸:Vx=[ 0. 0.60085865 0. 0. 0.
104
+
105
+ 1.99844704 13.97372388 26.14661623 33.45865115 39.10947701
106
+
107
+ 48.81643602 56.58503559 64.27425794 66.77673165 70.12174381
108
+
109
+ 79.35974097 80.40177396 84.69239012 88.86332873 92.62875202
110
+
111
+ 93.72125846 96.42706474 100.26938091 99.90817593 105.66469813
112
+
113
+ 107.064359 110.41424644 108.019962 106.01758445 102.6681563
114
+
115
+ 106.52688151 102.05290984 103.52503684 104.29990184 106.02583642
116
+
117
+ 103.45773805 102.04560391 108.22966384 104.21568472 104.17703327
118
+
119
+ 104.99710988 104.01952463 106.07237378 101.36822886 104.13346659
120
+
121
+ 108.51869321 105.92968331 105.24853623 109.43398266 106.77438881
122
+
123
+ 108.17147708 108.71728851 111.51358727 110.90520583 108.74029412
124
+
125
+ 105.61609635 111.41966345 105.45634023 109.90468592 119.16508715
126
+
127
+ 116.03951328]
128
+
129
+
4
130
 
5
131
 
6
132
 
7
133
  以下の図のような近似線を引きたいです.
8
134
 
9
- ![![イメージ説明](ff1bdbb3cc6d3c6e2600b4377c062016.jpeg)](280fa98428b2fa38931f6f110557111c.jpeg)
135
+ ![イメージ説明](26bccdc40ff206dc2871f76a80b98fbb.jpeg)