查看“︁B样条”︁的源代码
←
B样条
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
在[[数学]]的子学科[[数值分析]]裡,'''B-样条'''是[[样条曲线]]一种特殊的表示形式。它是B-样条基曲线的[[线性组合]]。B-样条是[[貝茲曲線]]的一种一般化,可以进一步推广为[[非均匀有理B样条]](NURBS),使得我们能给更多一般的几何体建造精确的模型。 [[De Boor算法]]是一个[[数值稳定性|数值上稳定]]的计算B样条的方法。 [[术语]] ''B样条''是[[Isaac Jacob Schoenberg]]创造的,B 是基(basis)样条的缩略。 == 定义 == 给定''m''+1 个节点''t''<sub>''i''</sub> ,分布在[0,1]区间,满足 :<math> t_0 < t_1 < \ldots < t_m</math> 一个''n''次'''B样条'''是一个[[参数曲线]]: :<math>\mathbf{S}:[0,1] \to \mathbb{R}^2</math> 它由''n''次'''B样条基(basis B-spline)'''组成 :<math>\mathbf{S}(t)= \sum_{i=0}^{m} \mathbf{P}_{i} b_{i,n}(t) \mbox{ , } t \in [0,1]</math>. '''P'''<sub>''i''</sub>称为'''控制点'''或'''de Boor点'''. ''m''+1个''n''次B样条基可以用'''Cox-de Boor递归公式''' 定义 :<math>b_{j,0}(t) := \left\{\begin{matrix} 1 & \mathrm{} \quad t_j < t < t_{j+1} \\ 0 & \mathrm{...} \end{matrix} \right. </math> :<math>b_{j,n}(t) := \frac{t - t_{j}}{t_{j+n} - t_j} b_{j,n-1}(t) + \frac{t_{j+n+1} - t}{t_{j+n+1} - t_{j+1}} b_{j+1,n-1}(t).</math> 当节点等距,称B样条为'''均匀'''(uniform)否则为'''非均匀'''(non-uniform)。 === 均匀B样条曲线 === 当B样条是均匀的时候,对于给定的''n'',每个B样条基是其他基的平移拷贝而已。一个可以作为替代的非递归定义是 :<math>b_{j,n}(t) := b_n(t + n - j) \qquad \mbox{ , } j = -1, \ldots m+1</math> 满足 :<math>b_n(t) := (m+1) \sum_{i=0}^{m+1} \omega_i(t_i - t)_+^{m} \qquad \mbox{ , } t \in [0,1]</math> 满足 :<math>\omega_i := \prod_{j=0, i \neq j}^{m+1} \frac{1}{t_i - t_k}</math> 其中 :<math>(t_i - t)_+</math> 是[[截断幂函数]](truncated power function) == 注解 == 当节点数和多项式次数相等时,B样条退化为[[貝茲曲線]]。即函数的形状由节点的位置决定。[[缩放]]或者[[平移]][[节点向量]]不会改变基函数。 样条包含在它的控制点的[[凸包]]中 ''n''次B样条的一个基 :<math>b_{i,n}(t)</math> 仅当在区间[''t''<sub>''i''</sub>, ''t''<sub>''i+n+1''</sub>]上非0。就是 :<math>b_{i,n}(t) = \left\{\begin{matrix} >0 & \mathrm{} \quad t_{i} \le t < t_{i+n+1} \\ 0 & \mathrm{...} \end{matrix} \right. </math> 换句话说,如果我们操作一个控制点,我们只改变曲线在局部的行为,而不像Bezier曲线那样是全局行为。 == 例子 == === 常数B样条 === 常数B样条是最简单的样条。只定义在一个[[节点距离]]上,而且不是节点的[[函数]]。它只是不同节点段(knot span)的[[指示函数]]。 :<math>b_{j,0}(t) = 1_{[t_j,t_{j+1})} = \left\{\begin{matrix} 1 & \mathrm{} \quad t_j \le t < t_{j+1} \\ 0 & \mathrm{...} \end{matrix} \right. </math> === 线性B样条 === 线性B样条定义在两个相邻的节点段上,在节点连续但不可微。 :<math>b_{j,1}(t) = \left\{\begin{matrix} \frac{t - t_j}{t_{j+1} - t_j} & \mathrm{if} \quad t_j \le t < t_{j+1} \\ \frac{t_{j+2} - t}{t_{j+2} - t_{j+1}} & \mathrm{ } \quad t_{j+1} \le t < t_{j+2} \\ 0 & \mathrm{... } \end{matrix} \right. </math> === 三次B样条 === 一个片断上的B样条的表达式可以写作: :<math>S_{i} (t) = \sum_{k=0}^3 \mathbf{P}_{i-3+k} b_{i-3+k,3} (t) \qquad \mbox{ , } t \in [0,1]</math> 其中'''S'''<sub>''i''</sub>是第''i''个B样条片断而P是一个控制点集,''i''和''k''是局部控制点索引。控制点的集合会是<math>P_i^w = ( w_i x_i, w_i y_i, w_i z_i, w_i)</math>的集合,其中<math>w_i</math>是比重,当它增加时曲线会被拉向控制点<math>P_i</math>,在减小时则把曲线远离该点。 片段的整个集合''m''-2条曲线(<math>S_3,S_4,...,S_m</math>)由''m''+1个控制点(<math>P_0,P_1,...,P_m, m \ge 3</math>)定义,作为''t''上的一个B样条可以定义为 :<math>S(t) = \sum_{i=0}^m \mathbf{P}_{i} b_{i,} (t)</math> 其中''i''是控制点数,''t''是取[[节点值]]的全局参数。这个表达式把B样条表示为B样条基函数的线性组合,这也是这个名称的原因。 有两类B样条-均匀和非均匀。非均匀B样条相邻控制点间的距离不一定要相等。一个一般的形式是区间随着插入控制点逐步变小到0。 == B樣條的程式指令 == === Matlab === In '''Matlab''',the command“spline” can be used for spline interpolation. (Note: In the command, '''the cubic B-spline ''' is used) '''Cubic B-Spline Interpolation by Matlab''' Generating a sine-like spline curve and samples it over a finer mesh: x = 0:1:10; % original sampling points y = sin(x); xx = 0:0.1:10; % new sampling points yy = spline(x,y,xx); plot(x,y,'o',xx,yy) === Python === '''事前安裝模組''' *pip install numpy *pip install scipy *pip install matplotlib '''Cubic B-Spline Interpolation by Python''' from scipy.interpolate import interp1d import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 11) # original sample points, [0, 1, 2, …, 9, 10] y = np.sin(x) f = interp1d(x, y, kind=' cubic ') ) # Cubic means the cubic B-spline. x_new = np.arange(0, 10.1, 0.1) # new sample points, [0, 0.1, 0.2, ….., 9.9, 10] y_new = f(x_new) plt.plot(x,y,'o',x_new, y_new) plt.show() == B样条曲面 == == B样条曲线及曲面相关算法 == 关于此处涉及的算法,在著作<ref> Les Piegl and Wayne Tiller: The NURBS Book, Springer-Verlag 1995-1997 (2nd ed). </ref>中有针对Bézier、B样条(B-spline)以及[[非均匀有理B样条]](Nurbs)的相关算法的详细数学表达和程序实现方法。 === 求导 === 在几何处理中,对参数曲线及曲面的求导是最基本的运算之一,由于参数表达的特性,在给定点的切线及法线可通过求导直接得到。 先来考察曲线的情形:采用本页定义中的B样条曲线表达式 <math>\mathbf{S}(t)= \sum_{i=0}^{m} \mathbf{P}_{i} b_{i,n}(t) \mbox{ , } t \in [0,1]</math> 对参数<math>t</math>进行求导: <math>\frac{d\mathbf{S}}{dt} = \sum_{i=0}^{m} b'_{i,n}(t) \mathbf{P}_{i}</math> === 节点插入与删除 === === 曲线及曲面拟合 === == 应用 == ===陣列信號處理=== 假設有多個訊號源,並考慮在遠場 (far-field) 的條件下,以一個多天線接收機所接收,多天線接收機具有 N 個獨立天線,且天線之間間距相同 𝑑 = 𝜆/2。 接收訊號 <math> x(t) = a(\theta_s(t))s(t) + a(\theta_i(t))i(t) + n(t), \quad t = 1, 2, \dots, L </math> <div>其中,s(t) 為欲接收的訊號源,i(t) 為其他訊號源造成的干擾,n(t) 為雜訊。</div> <div>指向向量 (steering vector)為:</div> <math> a(\theta_s(t)) = \begin{bmatrix} 1 & e^{j\pi \sin\theta} & e^{j2\pi \sin\theta} & \dots & e^{j(N-1)\pi \sin\theta} \end{bmatrix}^T </math> <div>權重向量 (weight vector) 定義為:</div> <math> w = \begin{bmatrix} w_0 & w_1 & \dots & w_{N-2} & w_{N-1} \end{bmatrix}^T </math> <div>波束成型 (beamformer)的輸出為:</div> <math> y(t) = w^H x(t) = w^H \left( a(\theta_s(t))s(t) + a(\theta_i(t))i(t) + n(t) \right) </math> 由於接收端不知道訊號源傳送的訊號為何,利用分段平均、內插重建方法可以降低雜訊 n(t) 的影響,還原低雜訊的角度成分。 <div>Step 1: 分段平均 (Segment Average)</div> <math> \tilde{\theta}_s(\tau + 1) = \frac{1}{L} \sum_{i=0}^{L-1} \tilde{\theta}_s(L\tau + i), \; \tau \in \mathbb{N} </math> <math> \tilde{\theta}_i(\tau + 1) = \frac{1}{L} \sum_{i=0}^{L-1} \tilde{\theta}_i(L\tau + i), \; \tau \in \mathbb{N} </math> <div>Step 2: 利用 cubic B-Spline Interpolation</div> B-Spline Interpolation 的關係式如下: <math> B_{n,0}(t) = \begin{cases} 1, & \text{for } t_n < t < t_{n+1} \\ 0, & \text{otherwise} \end{cases} </math> <math> B_{n,m}(t) = \frac{t - t_n}{t_{n+m} - t_n} B_{n,m-1}(t) + \frac{t_{n+m+1} - t}{t_{n+m+1} - t_{n+1}} B_{n+1,m-1}(t) \quad \text{for } t_n < t < t_{n+1} </math> <math> \text{where } B_{n,m}(t) \text{ is the } m\text{th order polynomial.} </math> <div>因為我們是使用 cubic B-Spline interpolation,所以選擇 m = 3 代入關係式。</div> <div>藉由上述兩步驟,我們可以得到訊號源和干擾源的DOA:</div> <math> \hat{\theta}_s(t) = \sum_{n=1}^N \tilde{\theta}_s(t_n) B_{n,3}(t) </math> <math> \hat{\theta}_i(t) = \sum_{n=1}^N \tilde{\theta}_i(t_n) B_{n,3}(t) </math> 優點: 用多項式內插函數重建平均化後的離散訊號可擬和出更接近連續的波型,同時降低高頻成分造成的影響。 == 参看 == *[[样条]] *[[De Boor算法]] *[[非均匀有理B样条]] == 参考 == {{FOLDOC}} {{Reflist}} ==參考文獻== {{refbegin}} * Jian-Jiun Ding, “Time Frequency Analysis and Wavelet Transforms ”, NTU, 2021. {{refend}} {{refbegin}} * Chun-Lin Liu, “Adaptive Signal Processing”, NTU, 2024. {{refend}} == 外部链接 == *[http://www.ibiblio.org/e-notes/Splines/Basis.htm Interactive java applets for B-splines]{{Wayback|url=http://www.ibiblio.org/e-notes/Splines/Basis.htm |date=20050404063539 }} *[http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/ Introduction to Computing with Geometry Notes (Dr.C.-K.Shene/Michigan Technological University)]{{Wayback|url=http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/ |date=20140316125439 }} [[Category:样条]] [[de:Spline#B-Splines]]
该页面使用的模板:
Template:FOLDOC
(
查看源代码
)
Template:Refbegin
(
查看源代码
)
Template:Refend
(
查看源代码
)
Template:Reflist
(
查看源代码
)
Template:Wayback
(
查看源代码
)
返回
B样条
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息