python繪制高斯曲線
本文實(shí)例為大家分享了python繪制高斯曲線的具體代碼,供大家參考,具體內(nèi)容如下
源碼:
import numpy as npimport matplotlib.pyplot as pltimport mathimport mpl_toolkits.mplot3dimport tensorflow.compat.v1 as tftf.disable_v2_behavior()#import tensorflow as tffrom sklearn import datasetssess = tf.InteractiveSession()gamma = tf.constant(-1.0)x, y = np.mgrid[-2:2:0.01, -2:2:0.01]x_data = tf.placeholder(shape=[400, 400], dtype=tf.float32)y_data = tf.placeholder(shape=[400, 400], dtype=tf.float32)Kernel = tf.exp(tf.multiply(gamma, tf.add((x_data*x_data),(y_data*y_data))))Kernel = sess.run(Kernel, feed_dict={x_data: x,y_data: y})ax = plt.subplot(111, projection=’3d’)ax.plot_surface(x, y, Kernel, rstride=1, cstride=1, cmap=’rainbow’, alpha=0.9)#繪面ax.set_xlabel(’x’)ax.set_ylabel(’y’)ax.set_zlabel(’Kernel’)plt.show()
效果圖:
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 小區(qū)后臺(tái)管理系統(tǒng)項(xiàng)目前端html頁面模板實(shí)現(xiàn)示例2. 基于javaweb+jsp實(shí)現(xiàn)企業(yè)車輛管理系統(tǒng)3. asp讀取xml文件和記數(shù)4. 前端從瀏覽器的渲染到性能優(yōu)化5. ASP.NET MVC遍歷驗(yàn)證ModelState的錯(cuò)誤信息6. ASP新手必備的基礎(chǔ)知識(shí)7. PHP中file_get_contents設(shè)置header請求頭,curl傳輸選項(xiàng)參數(shù)詳解說明8. asp知識(shí)整理筆記2(問答模式)9. python—sys模塊之獲取參數(shù)的操作10. python opencv通過按鍵采集圖片源碼
