您好,登錄后才能下訂單哦!
利用Python Matlab繪制曲線圖的實(shí)例分析,很多新手對此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。
我們在這里采用Python中的matplotlib來實(shí)現(xiàn)曲線圖形的繪制。matplotlib是著名的python繪圖庫,它提供了一整套繪圖API,十分適合交互式繪圖。
代碼:
具體的繪制的代碼如下所示:
import matplotlib.pyplot as plt import numpy as np r = np.array([2072.54, 2076.84, 2085.51, 2103.01, 2129.93, 2162.16, 2200.22, 2242.15, 2285.71, 2328.29, 2350.18, 2364.01, 2364.01, 2343.29, 2300.17, 2252.25, 2208.72, 2166.85, 2132.19, 2103.01, 2085.51, 2075.77, 2072.54]) b_ = np.array([30.159, 27.143, 24.127, 21.111, 18.096, 15.080, 12.064, 9.048, 6.032, 3.016, 1.508, 0, -1.508, -3.016, -6.032, -9.048, -12.064, -15.080, -18.096, -21.111, -24.127, -27.143, -30.159]) b = b_ * pow(10, -4) plt.plot(b, r) plt.xlabel("B/T") plt.ylabel("R/Ω") plt.title("GMB R-B (decreasing B)") plt.show()
效果:
代碼:
代碼與上一個(gè)的代碼其實(shí)是比較相似的:
import matplotlib.pyplot as plt import numpy as np r = np.array([2072.53, 2076.81, 2085.47, 2103.00, 2129.90, 2162.11, 2200.20, 2242.06, 2285.66, 2328.24, 2350.13, 2364.00, 2363.96, 2343.19, 2300.20, 2252.29, 2208.76, 2166.89, 2132.20, 2103.05, 2085.50, 2075.81, 2072.56]) b_ = np.array([30.159, 27.143, 24.127, 21.111, 18.096, 15.080, 12.064, 9.048, 6.032, 3.016, 1.508, 0, -1.508, -3.016, -6.032, -9.048, -12.064, -15.080, -18.096, -21.111, -24.127, -27.143, -30.159]) b = b_ * pow(10, -4) plt.plot(b, r) plt.xlabel("B/T") plt.ylabel("R/Ω") plt.title("GMB R-B (increasing B)") plt.show()
效果:
代碼:
代碼基本是形同的啦:
import matplotlib.pyplot as plt import numpy as np v = np.array([274, 270, 261, 243, 219, 189, 155, 118, 81, 48, 34, 21]) b_ = np.array([30.159, 27.143, 24.127, 21.111, 18.096, 15.080, 12.064, 9.048, 6.032, 3.016, 1.508, 0]) b = b_ * pow(10, -4) plt.plot(b, v) plt.xlabel("B/T") plt.ylabel("V/mV") plt.title("GMB V-B") plt.show()
效果:
代碼:
代碼其實(shí)都是基本一樣的,只不過主要是更換了數(shù)據(jù)啦:
import matplotlib.pyplot as plt import numpy as np w = np.array([43.5, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101, 104]) v = np.array([0, 5.7, 35.0, 53.8, 45.9, 7.7, -45.7, -51.9, -32.6, -1.8, 34.5, 53.1, 39.2, -10.1, -47.9, -51.4, -29.5, 5.6, 34.4, 52.4, 40.9, -5.2]) plt.plot(w, v) plt.xlabel("θ/rad") plt.ylabel("V/mV") plt.title("GMB V-θ") plt.show()
效果:
import numpy as np import matplotlib.pyplot as plt X = np.linspace(-4, 4, 1024) Y = .25 * (X + 4.) * (X + 1.) * (X - 2.) plt.title('$f(x)=\\frac{1}{4}(x+4)(x+1)(x-2)$') plt.plot(X, Y, c = 'g') plt.show()
看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注億速云行業(yè)資訊頻道,感謝您對億速云的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。