是诸如 TimeSeries, TemporalData 和 MovingMap 等函数的一个选项,指定应该如何计算给定时间之间的数值.
ResamplingMethod
是诸如 TimeSeries, TemporalData 和 MovingMap 等函数的一个选项,指定应该如何计算给定时间之间的数值.
更多信息
- ResamplingMethod 通常用于指定如何对时间序列进行重采样.
- 典型设置包括:
-
Automatic 自动挑选重采样方法 None 使用 Missing[] "LinearInterpolation" 使用线性(一阶)插值 "PreviousElement" 使用前一个元素 "NextElement" 使用后一个元素 "NearestElement" 使用最近的元素 {"Constant",c} 使用数值 c {"Interpolation",InterpolationOrderorder} 使用指定阶数 order 的插值 - TimeSeries 不接受 None 作为 ResamplingMethod 的值.
范例
打开所有单元 关闭所有单元基本范例 (3)
默认情况下,TimeSeries 中位于中间时刻的值使用线性插值计算:
ts1 = TimeSeries[{0, 1, 3, 2, 6, 2, 5}]ts1[1.5]ts2 = TimeSeries[{0, 1, 3, 2, 6, 2, 5}, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 2}]Plot[{ts1[t], ts2[t]}, {t, 0, 6}]将给定时间戳之间的值视为 Missing 对象:
TemporalData[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4]}, {{2, 4, 6, 8}}, ResamplingMethod -> None]%[Range[2, 8]]["Domain"]TimeSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4]}, {{2, 4, 6, 8}}, ResamplingMethod -> {"Constant", c}]%[Range[2, 8]]//Normal范围 (1)
ResamplingMethod 指定如何使用 TimeSeriesResample 对 TimeSeries 进行上采样:
ts = TimeSeries[{{1, -0.55}, {2, 0.58}, {3, 0.04}, {4, 0.98}, {5, -0.07}, {6, 0.91}, {7, -0.91}, {8, 0.468}, {9, -0.283}, {10, -0.029}}]ts0 = TimeSeriesResample[ts, 1 / 2, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]ts2 = TimeSeriesResample[ts, 1 / 2, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 2}]Show[ListPlot[ts, PlotStyle -> PointSize[.04]], ListLinePlot[{ts0, ts2}]]属性和关系 (2)
对于 EventSeries,默认 ResamplingMethod 为 None:
es = EventSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> True, "Count" -> 5,
"Endpoints" -> TabularColumn[Association["Data" -> {{1, 5}, {}, None},
"ElementType" -> "Integer64"]], "MinimumTimeIncrement" -> 1, "Caller" -> EventSeries]],
TabularColumn[Association["Data" -> {{-0.5543962648077652, 0.5825310698198298,
0.043602941865214184, 0.984529483672107, -0.0718708433783739}, {}, None},
"ElementType" -> "Real64"]], Association[]];TimeSeriesResample[es, 1 / 2]Normal[%]对于 TimeSeries,默认的 ResamplingMethod 是线性插值:
ts = TimeSeries[{{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}}]TimeSeriesResample[ts, 1 / 2]Normal[%]可能存在的问题 (2)
如果重采样方法规范无效,将使用 Automatic 值:
TimeSeries[{1, 2, 3}, ResamplingMethod -> foo]%["ResamplingType"]对于 TemporalData:
TemporalData[{1, 2, 3}, ResamplingMethod -> foo]%["ResamplingType"]TimeSeries 不允许将 None 用作 ResamplingMethod 的规范,并将使用默认方法:
ts = TimeSeries[{1, 2, 3}, ResamplingMethod -> None]ts["ResamplingType"]ts[.5]若要在这些时间戳之间仍保留 Missing,可以将其作为常数规范使用:
ts1 = TimeSeries[{1, 2, 3}, ResamplingMethod -> {"Constant", Missing[]}];ts1["ResamplingType"]ts1[.5]相关指南
-
▪
- 时间序列处理
文本
Wolfram Research (2014),ResamplingMethod,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ResamplingMethod.html (更新于 2026 年).
CMS
Wolfram 语言. 2014. "ResamplingMethod." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2026. https://reference.wolfram.com/language/ref/ResamplingMethod.html.
APA
Wolfram 语言. (2014). ResamplingMethod. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ResamplingMethod.html 年
BibTeX
@misc{reference.wolfram_2026_resamplingmethod, author="Wolfram Research", title="{ResamplingMethod}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/ResamplingMethod.html}", note=[Accessed: 08-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_resamplingmethod, organization={Wolfram Research}, title={ResamplingMethod}, year={2026}, url={https://reference.wolfram.com/language/ref/ResamplingMethod.html}, note=[Accessed: 08-September-2026]}