ArrayResample[array,{n1,n2,…}]
对 array 重新抽样以得到维数 {n1,n2,…}.
ArrayResample[array,dspec]
根据维数指定 dspec 对 array 重新抽样.
ArrayResample[array,dspec,scheme]
指定重新抽样的 scheme,基于点或箱.
ArrayResample[array,dspec,scheme,{{xmin,xmax},…}]
仅对指定子范围 {{xmin,xmax},…} 中的数据进行重新抽样.
ArrayResample
ArrayResample[array,{n1,n2,…}]
对 array 重新抽样以得到维数 {n1,n2,…}.
ArrayResample[array,dspec]
根据维数指定 dspec 对 array 重新抽样.
ArrayResample[array,dspec,scheme]
指定重新抽样的 scheme,基于点或箱.
ArrayResample[array,dspec,scheme,{{xmin,xmax},…}]
仅对指定子范围 {{xmin,xmax},…} 中的数据进行重新抽样.
更多信息和选项
- ArrayResample 可用在基于众多插值和逼近模型的数据数组的重新抽样.
- ArrayResample 适用于任何深度的数据数组.
- 维数指定 dspec 可以采用下列形式:
-
n n 个样本 Scaled[s] 通过系数 s 重新调整采样分辨率 All 保留维数 Automatic 保留维数比 {dspec1,…,dspeck} 对至多第 

- 对于多维数组,符号 n 被视为等价于 {n,Automatic,…},且 {n} 等价于 {n,All,…}.
- 维数为
的数组的维数比被视为
. - scheme 决定样本位置和重新抽样的位置,并可以采用下列形式:
-
"Point" 点抽样(默认) "Bin" 箱抽样 {"Bin",alignment} 具有指定 alignment 的箱抽样 - 对于长度为 n 的输入数据,"Point" 重新抽样方式假定数据范围是从 1 到 n,而 "Bin" 方式假定数据范围是从 0 到 n,并带有对齐方式,表示样本在各箱内的位置.
- 箱对齐 alignment 可以是 Left、Center、Right 或位于
(Left) 和 1 (Right) 之间的任意数值. - 数据范围可用 DataRange 选项修改.
- 默认情况下,数据在整个数据域重新抽样,对于 "Point" 方案,范围从1到
,对于 "Bin" 方案,范围从0到
. 使用 DataRange 选项修改数据域的坐标. - 通过相对于 DataRange 指定的子范围 {{xmin,xmax},…},仅对给定区间内的数据值进行重新抽样. »
- 可以给出下列选项:
-
Antialiasing False 在缩减像素采样时使用抗锯齿 DataRange Automatic 输入数据的范围 Padding "Fixed" 填充方法 Resampling Automatic 重新抽样方法 - 如要了解 Padding 的可能设置,请参见 ArrayPad 的参考页面.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (8)
基本用法 (4)
ArrayResample[{1, 2, 3}, 4]ArrayResample[{1.0000000000000000000, 2.0000000000000000000, 3.0000000000000000000, 4.0000000000000000000}, 6]ArrayResample[{a, b, c}, 5]input = Range[100];ArrayResample[input, 20, "Point", {55, 63}]输出维数 (1)
抽样方式 (3)
ArrayResample[{1, 2, 3}, 7, "Point"]ArrayResample[{1, 2, 3}, 6, "Bin"]ArrayResample[{1, 2, 3}, 6, {"Bin", -1}]input = {2, 1, 3, 4, 2, 5};
m = Length[input];
s = 3;
res1 = ArrayResample[input, Scaled[s]]pos = Range[1, m, (m - 1) / Round[s (m - 1)]]ListPlot[{Thread[{Range[m], input}], Thread[{pos, res1}]}, Joined -> {True, False}, PlotStyle -> {PointSize[.04], Automatic}, Mesh -> All]选项 (5)
Antialiasing (1)
DataRange (1)
DataRange 指定重新抽样的域. 子域规范是相对于此域进行定义的:
data = {0, 2, 0, 1, 4, 1, 9, 4, 4};ArrayResample[data, Scaled[2], "Point"]使用默认的 DataRange->{1,n},对前半部分数据进行重新抽样,其中 n 是 data 的长度:
ArrayResample[data, Scaled[2], "Point", {1, 5}]ArrayResample[data, Scaled[2], "Point", {0, 1 / 2}, DataRange -> {0, 1}]Padding (2)
ArrayResample[{1, 2, 3}, 9, "Bin"]ArrayResample[{1, 2, 3}, 9, "Bin", Padding -> 0]ArrayResample[(| | | |
| - | - | - |
| 1 | 2 | 3 |
| 2 | 1 | 6 |
| 3 | 6 | 2 |), 5, Resampling -> "Cubic", Padding -> 0]//N//MatrixFormArrayResample[(| | | |
| - | - | - |
| 1 | 2 | 3 |
| 2 | 1 | 6 |
| 3 | 6 | 2 |), 5, Resampling -> "Cubic", Padding -> {0, "Fixed"}]//N//MatrixFormResampling (1)
ArrayResample[{1, 2, 3}, 6]ArrayResample[{1, 2, 3}, 6, Resampling -> "Nearest"]如果抽样位置在样本的中间,"Nearest" 重新抽样对样本取平均:
ArrayResample[{1, 2, 3}, 5, Resampling -> "Nearest"]对于半整数采样位置,使用 "NearestLeft" 或 "NearestRight" 作为向左或向右的偏差:
ArrayResample[{1, 2, 3}, 5, Resampling -> "NearestLeft"]应用 (1)
属性和关系 (2)
a = {1, 3, 1, 2};
n = 25;
xpos = Array[#&, n, {1, Length[a]}];
Table[
result = ArrayResample[a, n, Resampling -> ker];
ListPlot[Transpose[{xpos, result}], PlotStyle -> PointSize[Medium], Epilog -> {Red, Line[Transpose[{Range[Length[a]], a}]]}, Axes -> {True, False}, PlotLabel -> ker],
{ker, {"Linear", "Cubic", "German"}}]Downsample 可用于整数因子的下抽样:
Downsample[Range[9], 2]ArrayResample[Range[9], Scaled[1 / 2]]可能存在的问题 (1)
input = Range[100];AbsoluteTiming[ArrayResample[input, 1000, Resampling -> "Cubic"];]对整数数据应用 N,从而使计算加快:
AbsoluteTiming[ArrayResample[N@input, 1000, Resampling -> "Cubic"];]技术笔记
-
▪
- 图像处理
文本
Wolfram Research (2014),ArrayResample,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ArrayResample.html (更新于 2016 年).
CMS
Wolfram 语言. 2014. "ArrayResample." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2016. https://reference.wolfram.com/language/ref/ArrayResample.html.
APA
Wolfram 语言. (2014). ArrayResample. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ArrayResample.html 年
BibTeX
@misc{reference.wolfram_2026_arrayresample, author="Wolfram Research", title="{ArrayResample}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/ArrayResample.html}", note=[Accessed: 15-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_arrayresample, organization={Wolfram Research}, title={ArrayResample}, year={2016}, url={https://reference.wolfram.com/language/ref/ArrayResample.html}, note=[Accessed: 15-September-2026]}