# 濾波微分 (`derivative`)

> 輸入的變化率乘上增益，帶一階濾波，所以不會無限放大雜訊。

![derivative](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/derivative.svg)

[元件參考](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/) · [English](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/derivative/)

**分類:** 控制 · **種類:** `{"block":"derivative","kind":"control"}`

## 何時使用

用於變化率：量測電流的 di/dt、自行搭建控制器的微分路徑，或由位置求速度。完整的 PID 請用 PID 控制器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `in` | 訊號 | 訊號輸入 |
| `out` | 訊號 | k 倍的濾波後變化率 |

## 常用參數

- `k`: Gain on the rate of change (預設值: 1)
- `fc`: Corner of the derivative filter; above it the gain levels off at k·2π·fc (預設值: 1k)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `k` | s | 1 |  | Gain on the rate of change |
| `fc` | Hz | 1k |  | Corner of the derivative filter; above it the gain levels off at k·2π·fc |

_參數說明在兩種語言中都是英文。_

## 模型

H(s) = k·ωc·s/(s + ωc)，ωc = 2π·fc：低於 fc 時是 k·s，也就是微分；高於 fc 時增益停在 k·ωc。斜率為 m 的斜坡在幾個時間常數 1/ωc 之後輸出 k·m。方塊和轉移函數一樣執行，所以輸出直接受當下輸入影響（直通）。

## 常見錯誤

- 輸入上的切換漣波最多會被放大 k·ωc 倍。請讓 fc 低於切換頻率，或先把輸入濾波。
- fc 必須為正。fc 相對 maxStep 太高時，梯形法會振鈴；請讓 1/(2π·fc) 有好幾個步長。

Problems 規則: `compile.error`, `solver.control`

## 規格書與來源

沒有規格書。

## 範例

以指令 `file.openExample` 開啟範例，名稱為 `demo:derivative`.

---
由 `cargo xtask reference` 依使用說明文字與參數規格產生，請勿手動編輯。
