本文へ移動
日本語
「FIR フィルターの周波数応答」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

A textbook figure of FIR design by the window method. The target is an ideal band (gain 1 between two edges, 0 elsewhere), drawn as a dashed step over a pale fill. Its ideal impulse response is infinitely long; the filter keeps 17 taps of it, h[−8] to h[8], multiplied by a rectangular or a Hamming window, and the solid line is the magnitude of the resulting response from 0 to π. The stem plot under it shows the 17 taps. The readout gives the overshoot (how far the response rises above 1) and the edge width (the widest 10% to 90% transition): a rectangular window keeps the edges steep but rings by about 9% (the Gibbs phenomenon), a Hamming window removes the ringing and doubles the edge width. When the band is narrower than 17 taps can resolve, the note says how high the response gets.

向いている場面

  • Teach why a finite filter cannot have a brick-wall response, and what a window trades: ringing against edge width.
  • Let learners draw low-pass, band-pass and high-pass targets and watch the taps change shape.

向かない場面

  • For designing a production filter, use a design tool with more taps and an equiripple method: this figure fixes the length at 17 and offers two windows.

使い方

import React, { useState } from 'react'
import { FirTemplateBench } from './FirTemplateBench.jsx'

export function FilterLesson() {
  const [band, setBand] = useState({ low: 0.25, high: 0.6 })
  return (
    <FirTemplateBench
      value={band}
      onChange={(next, { taps, overshoot }) => setBand(next)}
      defaultWindowShape="hamming"
      labels={{ title: 'A band-pass filter with 17 taps' }}
    />
  )
}

プロパティ

プロパティ型既定値説明
value{ low, high }—目標帯域を外部から指定します。両端は π(ナイキスト周波数)に対する割合で 0〜1、0.05 刻みで、間隔は 0.05 以上です。low が 0 なら低域通過、high が 1 なら高域通過です。
defaultValue{ low, high }{ low: 0.25, high: 0.6 }内部状態での初期帯域です。どちらの使い方でもリセットはここに戻ります。
onChange(band, result) => void—新しい帯域と { reason('drag'、'draw'、'tap'、'key'、'cancel'、'reset')、edge('low'、'high'、null)、taps(h[−8]〜h[8] の 17 個)、overshoot(割合)、edgeWidth(π に対する割合、または null)} を受け取ります。
windowShape'rectangular' | 'hamming'—17 タップに掛ける窓関数を外部から指定します。
defaultWindowShape'rectangular' | 'hamming''rectangular'内部状態での初期の窓関数で、リセットでここに戻ります。
onWindowShapeChange(shape, { reason }) => void—窓関数が変わったときに呼ばれます。reason は 'press'、'key'、'reset' です。
labelsobject—組み込みの文言を置き換えます:title、caption、target、response、taps、window、rectangular、hamming、low、high、overshoot、edgeWidth、hint、narrow('{peak}')、reset。
localestring'en'数値の表示に使う言語タグです。
classNamestring—カードに追加するクラス名です。幅の指定などに使います(既定は 30rem、コンテナより広くなりません)。

アクセシビリティ

  • The two edges are sliders named Lower edge and Upper edge, with value text such as 0.25π. Arrow keys move an edge by 0.05π, Shift and Page Up or Down by 0.2π, Home and End to the ends of its range; the edges never cross.
  • The window is a radio group with one tab stop; arrow keys change it. Reset is a button, marked unavailable while nothing has changed.
  • The readout is a polite live region with the overshoot, the edge width and a note. The stem plot is an image whose name lists the 17 taps.
  • Dragging uses pointer capture. A press near an edge drags it; elsewhere a sideways drag draws a new band and a tap moves the nearest edge there. The edge strips set touch-action: none; the rest of the plot sets pan-y, so a vertical swipe still scrolls the page. Escape or a cancelled gesture puts the band back.
  • Colour is not the only key: the target is dashed and the response solid, the legend names both, and the edges carry their values above the plot.

モーション

Nothing animates: the response, the taps and the readout redraw on every input, and a dragged edge follows the pointer directly. Only hover and press feedback use transitions, and reduced motion turns them off.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

FirTemplateBench.jsxfir-template-bench.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

グラフ
「三辺測位」は Pro に含まれます。解除するとプレビューが表示されます。