日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

三次样条插值

發布時間:2025/3/19 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 三次样条插值 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

根據起始點以及目標點,可以得到若干包含目標點的插值曲線,如下圖。

# python代碼import numpy as npimport matplotlib.pyplot as pltx = np.arange(-0.1, 0.2, 0.02)# y = 2(y_start - y_mid) / (x_mid - x_start)^3 * (x - x_start)^3 + 3(y_mid - y_start) / (x_mid - x_start)^2 * (x - x_start)^2 + y_start# x_start=-0.1, y_start=0.8, x_mid=0.1, y_mid=0.9y = -25 * (x + 0.1)**3 + 7.5 * (x + 0.1)**2 + 0.8y2 = 25 * (x + 0.1)**3 - 7.5 * (x + 0.1)**2 + 0.8# x_start=-0.1, y_start=0.8, x_mid=0.1, y_mid=1.0y5 = -50 * (x + 0.1)**3 + 15 * (x + 0.1)**2 + 0.8y6 = 50 * (x + 0.1)**3 - 15 * (x + 0.1)**2 + 0.8# x_start=-0.1, y_start=0.8, x_mid=0.1, y_mid=1.1y7 = -75 * (x + 0.1)**3 + 22.5 * (x + 0.1)**2 + 0.8y8 = 75 * (x + 0.1)**3 - 22.5 * (x + 0.1)**2 + 0.8plt.plot(x, y, 'b-.')plt.plot(x, y2, 'b-.')plt.plot(x, y5, 'b-.')plt.plot(x, y6, 'b-.')plt.plot(x, y7, 'b-.')plt.plot(x, y8, 'b-.')plt.show()''' plt.xlabel("x") plt.ylabel("y") plt.ylim(0, 1) plt.legend() '''

import numpy as npimport matplotlib.pyplot as pltdef cubicSpline(self):fig = plt.figure()sub1 = plt.subplot(1,1,1)plt.xlabel('X(m)')plt.xlim([-0.2, 0.2])plt.ylabel('Y(m)')plt.ylim([0.65,1.05])sub1.spines['top'].set_visible(False)#取消上邊框sub1.spines['right'].set_visible(False) x = np.arange(-0.1, 0.2, 0.02)# y = 2(y_start - y_mid) / (x_mid - x_start)^3 * (x - x_start)^3 + 3(y_mid - y_start) / (x_mid - x_start)^2 * (x - x_start)^2 + y_start# x_start=-0.1, y_start=0.8, x_mid=0.1, y_mid=0.9y = -25 * (x + 0.1)**3 + 7.5 * (x + 0.1)**2 + 0.8y2 = 25 * (x + 0.1)**3 - 7.5 * (x + 0.1)**2 + 0.8# rotate 45°xs, ys = x[0], y[0]an = 45*np.pi/180x3 = (x - xs) * np.cos(an) - (y - ys) * np.sin(an) + xsy3 = (x - xs) * np.sin(an) + (y - ys) * np.cos(an) + ys x4 = (x - xs) * np.cos(an) - (y2 - ys) * np.sin(an) + xsy4 = (x - xs) * np.sin(an) + (y2 - ys) * np.cos(an) + ysplt.plot(x, y, 'b-.')plt.plot(x, y2, 'b-.')plt.plot(x3, y3, 'r-.')plt.plot(x4, y4, 'r-.')plt.show()

總結

以上是生活随笔為你收集整理的三次样条插值的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。