FindPeaks
詳細とオプション
- FindPeaksは,指定された制約条件を使って極大値を求め,結果を{{x1,y1},{x2,y2},…}として返す.
- 入力 list は以下のいずれの形式でもよい.
-
{y1,y2,…} 値のリスト TimeSeries[…] 定期的にサンプリングされた時系列オブジェクト EventSeries[…] 定期的にサンプリングされた事象系列オブジェクト - FindPeaks[list]は,スケール,鋭度,閾値のパラメータを自動的に選択する.
- ノイズに関連した峰の検出を避けるために,入力は標準偏差 σ を使ったガウスのフィルタリングで正則化される.
- σ の値は,デフォルトで,
である.n は list 中のデータ点の数である.σ の値が大きいと峰の数が少なくなる. - 正規化されたデータ中に検出された峰は対応するもとのデータの峰まで追跡される.
- デフォルトで,峰は鋭度(
)に基づいてはフィルターされない.鋭度 s はスケール σ のガウスフィルタによってデータの二次導関数として計算される.{s,σs}を使ってより小さいスケールを指定する. - デフォルトで,任意の高さの峰が返される.閾値 t を使って小さい値の峰を無視する.0以外のスケールで閾値を適用する場合には{t,σt}を使う.
- FindPeaks[list,σ,s,t]はFindPeaks[list,σ,{s,σ},{t,0}]に等しい.
- 使用可能なオプション
-
InterpolationOrder Automatic 次数3までのスプライン補間次数 Padding "Reflected" 使用する充填スキーム - デフォルトで,データのリストにはInterpolationOrder1が仮定される.TimeSeriesオブジェクトについては,補間次数が継承される.
- 峰の位置の計算には補間次数が使われる.峰は{x,y}サンプルの補間次数の間や上にあることがある.
- 補間次数0あるいは1については,2つあるいはそれ以上のデータサンプルのプラトーの中心位置に単一の峰が割り当てられる.
- Paddingの可能な設定については,ArrayPadの関数ページを参照のこと.
例題
すべて開く すべて閉じる例 (1)
スコープ (12)
データ (4)
list = {1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 3, 2, 4, 2, 2, 1};ListLinePlot[
{list, FindPeaks[list]},
Joined -> {True, False},
PlotStyle -> {Automatic, PointSize[.03]}
]TimeSeriesオブジェクトの峰:
ts = TemporalData[TimeSeries, {{{54.75, 54.09, 53.89, 55.86, 55.9, 55.63, 53.63, 53.46, 54.15, 57.9,
56.9, 56.63, 56.2, 57.04, 58.32, 57.63, 59.21, 61.06, 62.48, 63.5, 62.74, 62.52, 64.4, 64.96,
64.06, 64.87, 67.06, 69.04, 68.12, 72.64, 73.5, ... 75.04,
75.59, 76.79, 76.86, 77.28, 78.76, 79.4, 79.81, 80.63, 80.88, 81.04, 81.15}},
{TemporalData`DateSpecification[{2013, 1, 2, 0, 0, 0.}, {2013, 11, 27, 0, 0, 0}, {1, "Week"}]},
1, {"Discrete", 1}, {"Discrete", 1}, 1, {}}, True, 10.];peaks = FindPeaks[ts, 0, 0, 0]DateListPlot[
{ts, peaks},
Joined -> {True, False},
PlotStyle -> {Automatic, PointSize[.03]}
]EventSeriesオブジェクトの峰:
v = RandomInteger[{-10, 10}, n = 50];
t = N@Range[0, 1, 1 / (n - 1)];es = EventSeries[v, {t}]peaks = FindPeaks[es, 1, 0, 0]DateListPlot[
{es, peaks["Path"]},
Joined -> {False, False},
Filling -> Axis,
PlotStyle -> {Automatic, PointSize[.03]}
]Quantityオブジェクトのリストの峰:
data = {Quantity[9, "Feet"], Quantity[86, "Inches"], Quantity[27, "Meters"], Quantity[79, "Feet"], Quantity[90, "Feet"], Quantity[41, "Inches"], Quantity[99, "Inches"], Quantity[6, "Feet"], Quantity[38, "Feet"], Quantity[89, "Feet"], Quantity[53, "Feet"], Quantity[85, "Meters"], Quantity[92, "Meters"], Quantity[95, "Meters"], Quantity[49, "Feet"]};peaks = FindPeaks[data]ListPlot[{data, peaks}, Joined -> {True, False}, PlotStyle -> {Automatic, PointSize[.03]}]peaks30 = FindPeaks[data, Automatic, Automatic, Quantity[30, "Meters"]]ListPlot[
{data, peaks30},
Joined -> {True, False},
PlotStyle -> {Automatic, PointSize[.03]},
AxesLabel -> {None, "height [ft]"}
]パラメータ (8)
v = {2, 1, 6, 5, 7, 4};
FindPeaks[v]v = {2, 1, 6, 5, 7, 4};
FindPeaks[v, 0]list = Table[ Sin[x] + RandomReal[.5{-1, 1}], {x, 0, 3 Pi, 0.1}];
ListLinePlot[list]Table[ListPlot[{list, FindPeaks[list, σ]}, Joined -> {True, False}, PlotStyle -> {Automatic, PointSize[.04]}], {σ, {1, 2, 4}}]スケール
での峰を求めるときは,スケール
までのぼやけに耐える峰のみが返される:
values = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 3, 4, 2, 2, 1};peaks = FindPeaks[values, 1]ListLinePlot[
{values, GaussianFilter[values, {3, 1}], peaks},
Joined -> {True, True, False},
PlotStyle -> {Automatic, Dashed, {Red, PointSize[0.03]}}, PlotLegends -> {"original", "smoothed", "peaks"},
ImageSize -> 240
]デフォルトで,峰は
に等しいその鋭さに基づいてはフィルターされない:
values = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 2, 3, 4, 3, 2};FindPeaks[values, 0, 0]values = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 2, 3, 4, 3, 2};peaks = FindPeaks[values, 0, 3]鋭さは,負の第2導関数で定義され,指定された s より大きくなければならない:
ListLinePlot[
{values,
ListConvolve[{1, -2, 1}, ArrayPad[values, 1, "Reversed"]],
peaks},
...
]list = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 1, 4, 2, 2, 1};peaks = FindPeaks[list, 0, 0, 5.1]ListLinePlot[{list, peaks}, ...]list = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 1, 4, 2, 2, 1};peaks = FindPeaks[list, 2, 0, {5.1, 1}]ListPlot[{list, GaussianFilter[list, 1{3, 1}], peaks}, ...]オプション (3)
InterpolationOrder (1)
デフォルトで,InterpolationOrder1が使われる:
values = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 3};peaks = FindPeaks[values, 0]ListPlot[{values, peaks}, ...]peaks = FindPeaks[values, 0, InterpolationOrder -> 3]峰の数と位置は補間次数によって異なることがあるので注意のこと:
ListPlot[{values, peaks}, InterpolationOrder -> 3, ...]Padding (2)
デフォルトで,Padding"Reflected"が使われる:
values = {2, 1, 3, 5, 6, 6, 4, 3, 2, 4, 7, 3, 4, 2, 2, 1};peaks = FindPeaks[values, 0]ListPlot[{values, peaks}, Joined -> {True, False}, PlotStyle -> {Automatic, {PointSize[.03], Red}}]peaks = FindPeaks[values, 0, Padding -> 4]ListPlot[{values, peaks}, Joined -> {True, False}, PlotStyle -> {Automatic, {PointSize[.03], Red}}]values = {2, 1, 3, 5, 6, 7, 3, 2, 1};デフォルトで,"Reflected"充填をすると峰が位置1に出現する:
peaks = FindPeaks[values, 0, Padding -> "Reflected"];
ListLinePlot[{values, peaks}, ...]values = {2, 1, 3, 5, 6, 7, 3, 2, 1};peaks = FindPeaks[values, 0, Padding -> "Reversed"];
ListLinePlot[{values, peaks}, ...]peaks = FindPeaks[values, 0, Padding -> "Fixed"];
ListLinePlot[{values, peaks}, ...]アプリケーション (6)
data = FinancialData["AAPL", {{2013, 1, 1}, {2014, 1, 1}, "Day"}]resampled = TimeSeriesResample[data, "Day"]peaks = FindPeaks[resampled, 3]DateListPlot[resampled, Epilog -> {Orange, PointSize[0.03], Point[QuantityMagnitude@peaks["Path"]]}]list = QuantityMagnitude[GeoElevationData[{GeoPosition[{0, 0}], GeoPosition[{.2, 180}]}]][[1]];peaks = FindPeaks[list, 3];ListPlot[{list, peaks}, ...]temp = WeatherData["Chicago", "MeanTemperature", {{2014, 11, 1}, {2014, 12, 31}, "Day"}]DateListPlot[temp]peaks = FindPeaks[temp, 0, Automatic, Quantity[0, "DegreesCelsius"]];DateListPlot[{temp, peaks}, ...]ecg = {...};peaks = FindPeaks[ecg, 8, {0.01, 0}, InterpolationOrder -> 2]ListPlot[{ecg, peaks}, Joined -> {True, False}, PlotStyle -> {Automatic, {Orange, PointSize[.03]}},
InterpolationOrder -> 2, PlotRange -> All, Axes -> None]ヒストグラムの峰を使って分布の最頻値を検出する.フレシェ(Fréchet)分布からサンプルを取る:
samples = RandomReal[FrechetDistribution[2.5, 16.0], {1000000}];histogram = Last@HistogramList[samples, {0.5, 50.5, 1}]mode = FindPeaks[histogram, InterpolationOrder -> 2][[1, 1]]Histogram[samples, {0.5, 50.5, 1}, Epilog -> {Line[{{mode, 0}, {mode, 1000000}}]},
Axes -> {True, False}
]x /. FindRoot[Subscript[∂, x]PDF[FrechetDistribution[2.5, 16.0], x], {x, 14}]flute = ExampleData[{"Audio", "Flute"}]spectrum = Take[PeriodogramArray[flute], 10000];peaks = FindPeaks[spectrum, 8, Automatic, 1, InterpolationOrder -> 2]ListLinePlot[spectrum, PlotRange -> All, Epilog -> {Red, Point[peaks]}]min = UnitConvert[Information[flute, "SampleRate"] / Information[flute, "Length"], "Hertz"]min peaks[[All, 1]]関連するガイド
-
▪
- データの変換と平滑化 ▪
- 曲線のフィットと近似の関数 ▪
- 信号の可視化と解析 ▪
- 特徴検出 ▪
- 統計的データ解析 ▪
- 信号処理
テキスト
Wolfram Research (2014), FindPeaks, Wolfram言語関数, https://reference.wolfram.com/language/ref/FindPeaks.html (2021年に更新).
CMS
Wolfram Language. 2014. "FindPeaks." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/FindPeaks.html.
APA
Wolfram Language. (2014). FindPeaks. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindPeaks.html
BibTeX
@misc{reference.wolfram_2026_findpeaks, author="Wolfram Research", title="{FindPeaks}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/FindPeaks.html}", note=[Accessed: 17-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_findpeaks, organization={Wolfram Research}, title={FindPeaks}, year={2021}, url={https://reference.wolfram.com/language/ref/FindPeaks.html}, note=[Accessed: 17-November-2026]}