# 递归最小二乘滤波器

递归最小二乘（RLS）滤波器是一种自适应滤波算法，它通过递归方式寻找使与输入信号相关的加权线性最小二乘代价函数最小化的滤波器系数，每来一个新的数据样本就更新一次系数，而不是重新计算批处理解。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup> 与基于当前时刻误差进行自适应调整的最小均方（LMS）算法不同，RLS基于从数据起点开始计算的总误差进行自适应调整。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 目标 | 最小化期望信号与滤波器输出之间从第一个样本到当前样本的指数加权总平方误差<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup> |
| 遗忘因子 | \( \lambda \in (0,1] \) 对近期样本赋予更大权重；典型值位于 \([0.9, 0.999]\) 区间<sup>[2](https://eden.dei.uc.pt/~tbohnert/math/ap-cp.pdf)</sup><sup> • </sup><sup>[3](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)</sup> |
| 收敛性 | 在大多数条件下，RLS比LMS收敛更快，且相对于未知系统能达到更小的稳态误差<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup><sup> • </sup><sup>[3](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)</sup> |
| 每步计算量 | 对于 \( N \) 个系数的滤波器，需要 \( O(2N^2 + 4N) \) 次运算，因为矩阵求逆被标量除法所取代<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup> |
| 收敛保证 | 在输入满足持续激励条件时，带指数遗忘的RLS呈指数收敛<sup>[5](https://www.sciencedirect.com/science/article/pii/S0167691182800145)</sup> |
| 已知弱点 | 在非持续激励条件下，协方差矩阵可能无界增长（协方差发散），导致算法数值不稳定<sup>[6](https://www.energy-proceedings.org/robust-online-parameter-identification-for-batteries-using-exponential-resetting-recursive-least-squares/)</sup> |
| 与卡尔曼滤波器的关系 | RLS在自适应滤波性能上接近卡尔曼滤波器；它可以被视为一种状态恒定、噪声具有异方差性的特定状态空间模型<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup><sup> • </sup><sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup> |

## 代价函数与遗忘因子

对于输出为 \( y(n) = \sum_{k=0}^{M-1} b_k f(n-k) \) 的FIR滤波器，第 \( n \) 次迭代的总平方误差为 \( E(n) = \sum_{i=0}^{n} (d(i) - y(i))^2 \)。<sup>[3](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)</sup> RLS对此进行修改，在每个误差项上引入指数遗忘因子 \( \lambda^{n-i} \)，其中 \( 0 < \lambda \le 1 \)，于是代价函数变为 \( E'(n) = \sum_{i=0}^{n} \lambda^{n-i} (d(i) - y(i))^2 \)。<sup>[3](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)</sup>

因子 \( \lambda \) 对近期数据点赋予更大权重，从而使滤波器能够跟踪输入数据中变化的统计特性。<sup>[3](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)</sup> 当 \( \lambda = 1 \) 时，所有历史误差具有相同权重；当 \( \lambda \) 趋近于零时，历史误差的作用变小。当 \( \lambda = 0.1 \) 时，50个样本之前的误差被乘以 \( 0.1^{50} = 1 \times 10^{-50} \)。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup> 遗忘因子还给出了算法记忆长度的实用概念：当 \( N = \frac{1+\lambda}{1-\lambda} \approx \frac{2}{1-\lambda} \) 时，对 \( N \) 个数据点的批处理最小二乘估计与RLS给出近似相同的参数协方差。<sup>[2](https://eden.dei.uc.pt/~tbohnert/math/ap-cp.pdf)</sup>

## 算法

对于线性回归模型 \( y_t = \varphi_t^T \theta_t + e_t \)，RLS参数更新为如下递推式

\[ \hat{\theta}_t = \hat{\theta}_{t-1} + K_t \left( y_t - \varphi_t^T \hat{\theta}_{t-1} \right) \]

其中增益和协方差更新为

\[ K_t = \frac{P_{t-1}\varphi_t}{\lambda + \varphi_t^T P_{t-1}\varphi_t} \]

\[ P_t = \frac{1}{\lambda} \left( P_{t-1} - \frac{P_{t-1}\varphi_t\varphi_t^T P_{t-1}}{\lambda + \varphi_t^T P_{t-1}\varphi_t} \right). \]

此处 \( P_t \) 与估计的协方差矩阵相关，但 \( P_t \neq \mathrm{Cov}\,\hat{\theta} \)。<sup>[2](https://eden.dei.uc.pt/~tbohnert/math/ap-cp.pdf)</sup> 直接最小二乘解所需的矩阵求逆被 \( K_t \) 分母中的标量除法所取代。<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup> 典型初始化在无相关矩阵先验知识时采用 \( \mathbf{c}(0) = 0 \) 和 \( \mathbf{P}(0) = \delta^{-1}\mathbf{I} \)，其中 \( \delta \) 取小值。<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup>

系数更新使滤波器沿增益向量 \( \mathbf{P}(t)\mathbf{x}(t) \) 的方向移动，移动量由误差控制，而 \( \mathbf{P}(t) \) 的自适应仅依赖于输入，\( \lambda \) 则调制整个系统的时变响应。<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup> 在数据流实现中，预测首先使用之前的系数计算（即先验误差，等价于序贯预测或先测后训范式），因此新输入一到就能立即得到输出。<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup>

## 与LMS的比较

LMS是一种基于梯度的算法，利用均方误差的梯度更新权重，对历史误差值没有记忆；RLS最小化总加权平方误差，考虑了从起始到当前样本的所有历史数据。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup> 代价在于计算量：RLS以每步更多运算为代价，换来了相对于未知系统更快的收敛速度和更小的误差，在性能上接近卡尔曼滤波器，同时对信号处理器的吞吐量要求有所降低。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup> 两者的信号路径和辨识设置相同，区别在于自适应部分。<sup>[1](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)</sup>

在流式处理场景中，计算量的差距至关重要。由于RLS是常用自适应算法中计算需求最大的，阈值化变体在误差低于阈值 \( \zeta \) 时跳过更新，从而在保持快速收敛的同时减少平均更新次数。<sup>[4](https://link.springer.com/article/10.1007/s41060-025-00766-3)</sup>

## 收敛性与激励条件

**持续激励是核心条件。** 约翰斯通、约翰逊、比特米德和安德森于1982年证明，只要系统输入满足持续激励条件，带指数遗忘因子的RLS算法呈指数收敛，且遗忘因子对于实现这种收敛是必要的，而激励的持续性几乎是必要的；该结果适用于稳定的有限维线性时不变系统。<sup>[5](https://www.sciencedirect.com/science/article/pii/S0167691182800145)</sup> 后续扩展涵盖了多输入多输出（MIMO）系统，在持续激励条件下同样证明了估计误差的指数收敛性。<sup>[7](https://doi.org/10.1016/J.AUTOMATICA.2020.109389)</sup>

对于跟踪时变模型，郭在1993年对遗忘因子RLS算法的分析得到了三个结果：P矩阵有界当且仅当回归量的时变协方差矩阵一致非奇异；当该条件满足时，参数跟踪误差协方差为 \( O(\mu + \gamma^2/\mu) \) 量级，其中 \( \mu = 1 - \lambda \)，\( \gamma \) 反映参数变化的速度；对于小 \( \mu \)，该协方差可以用一个易于计算的表达式任意好地近似。<sup>[8](https://onlinelibrary.wiley.com/doi/pdf/10.1002/acs.4480070604)</sup> 变速率遗忘变体用时变因子替代常数 \( \lambda \)，在持续激励下收敛到真实参数，并在不相关测量噪声下保持一致性。<sup>[9](https://doi.org/10.1016/J.AUTOMATICA.2020.109052)</sup>

## 协方差发散及其补救

当输入不满足持续激励条件时，遗忘因子RLS性能退化：协方差发散现象被触发，算法变得数值不稳定，失去提供可靠估计的能力。<sup>[6](https://www.energy-proceedings.org/robust-online-parameter-identification-for-batteries-using-exponential-resetting-recursive-least-squares/)</sup> 这在在线电池模型辨识等激励并非始终持续的应用中至关重要。指数重置RLS（ERRLS）修改信息矩阵更新，保证在无激励时向非零矩阵指数收敛，无论激励是否持续都能产生有界协方差矩阵；实验表明在持续激励条件被违反时性能优于标准FFRLS。<sup>[6](https://www.energy-proceedings.org/robust-online-parameter-identification-for-batteries-using-exponential-resetting-recursive-least-squares/)</sup> 相关扩展包括指数重置和循环重置RLS，它们在持续激励下性能与指数遗忘RLS几乎相同，而在激励丢失时能防止协方差发散；还有变方向遗忘方法，用于补偿持续性的丧失。<sup>[10](https://www.researchgate.net/publication/366360322_Exponential_Resetting_and_Cyclic_Resetting_Recursive_Least_Squares)</sup><sup> • </sup><sup>[11](https://arxiv.org/abs/2003.03523)</sup> 申和李提出的一种新指数遗忘算法针对同样的估计器发散问题，同时保持快速收敛速度。<sup>[12](https://arxiv.org/abs/2004.03910)</sup>

## 有限精度下的数值稳定性

在有限精度实现中，舍入误差可能累积。利亚瓦斯和雷加利亚研究了传统RLS算法的非线性舍入误差累积系统，推导出了计算相对精度的界限（以问题的条件数和遗忘因子表示），该界限保证有限精度实现的数值稳定性，并保持有限精度逆数据协方差矩阵的正定性。<sup>[13](https://www.telecom.tuc.gr/~liavas/publications/On%20the%20Numerical%20Stability%20and%20Accuracy%20of%20the%20Conventional%20Recursive%20Least%20Squares%20Algorithm.pdf)</sup> 他们还分析了爆炸性发散——即有限精度效应导致的突发大误差，这与有限精度逆数据协方差矩阵正定性的丧失有关。<sup>[13](https://www.telecom.tuc.gr/~liavas/publications/On%20the%20Numerical%20Stability%20and%20Accuracy%20of%20the%20Conventional%20Recursive%20Least%20Squares%20Algorithm.pdf)</sup> 他们的仿真证实，实测的累积舍入误差在稳态下满足解析预测的界限。<sup>[13](https://www.telecom.tuc.gr/~liavas/publications/On%20the%20Numerical%20Stability%20and%20Accuracy%20of%20the%20Conventional%20Recursive%20Least%20Squares%20Algorithm.pdf)</sup> 相对精度界限与 \( 1 - \lambda \) 成正比，因此当 \( \lambda \) 非常接近1时，舍入误差累积更为显著。<sup>[13](https://www.telecom.tuc.gr/~liavas/publications/On%20the%20Numerical%20Stability%20and%20Accuracy%20of%20the%20Conventional%20Recursive%20Least%20Squares%20Algorithm.pdf)</sup>

平方根形式通过传播协方差矩阵的平方根因子而非矩阵本身来解决同一问题；基于QR分解的RLS变体已被应用于脉动阵列的可能实现。<sup>[14](https://skoge.folk.ntnu.no/prost/proceedings/ifac2008/data/papers/0771.pdf)</sup>

## 变体与应用

RLS家族超越了基本的横向形式。通过递归扩展标准块数据Levinson最小二乘解而得到的递归最小二乘格型滤波器，已在语音波形合成、地震反卷积、高分辨率谱估计、自适应谱线增强、噪声自适应抵消和天线阵列自适应处理中得到广泛应用。<sup>[15](https://dtic.minsky.ai/index/ADA137554)</sup> 自适应滤波算法分为四大类，其中一类包括RLS算法及其快速版本，其余包括QR和逆QR最小二乘算法、最小二乘格型算法以及LMS等基于梯度的算法。<sup>[16](https://ieeexplore.ieee.org/document/295229/)</sup>

除信号处理外，RLS还用于系统辨识和自适应控制中的在线参数估计，包括从输入输出数据对对象动态特性和PID控制器参数进行闭环辨识。<sup>[17](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cth2.12605)</sup> RLS方法也被应用于使用线性值函数近似器的强化学习。<sup>[18](https://arxiv.org/abs/1106.0707)</sup>

## References

1. [Compare RLS and LMS Adaptive Filter Algorithms, MathWorks](https://www.mathworks.com/help/dsp/ug/compare-rls-and-lms-adaptive-filter-algorithms.html)
2. [Adaptive Filtering, lecture notes (RLS section)](https://eden.dei.uc.pt/~tbohnert/math/ap-cp.pdf)
3. [Introduction to Recursive-Least-Squares (RLS) Adaptive Filters, D. Rowell, MIT OCW 2.161, Fall 2008](https://ocw.mit.edu/courses/2-161-signal-processing-continuous-and-discrete-fall-2008/0908e93cb4f31eac9150b14c1ffdf328_rls.pdf)
4. [Linear adaptive filtering for regression in data streams, International Journal of Data Science and Analytics](https://link.springer.com/article/10.1007/s41060-025-00766-3)
5. [Johnstone, Johnson, Bitmead, Anderson (1982). Exponential convergence of recursive least squares with exponential forgetting factor. Systems & Control Letters 2(2).](https://www.sciencedirect.com/science/article/pii/S0167691182800145)
6. [Robust online parameter identification for batteries using exponential resetting recursive least squares, Energy Proceedings](https://www.energy-proceedings.org/robust-online-parameter-identification-for-batteries-using-exponential-resetting-recursive-least-squares/)
7. [Brüggemann, Bitmead (2021). Exponential convergence of recursive least squares with forgetting factor for multiple-output systems. Automatica 124.](https://doi.org/10.1016/J.AUTOMATICA.2020.109389)
8. [Guo (1993). Performance analysis of the forgetting factor RLS algorithm. International Journal of Adaptive Control and Signal Processing.](https://onlinelibrary.wiley.com/doi/pdf/10.1002/acs.4480070604)
9. [Bruce, Goel, Bernstein (2020). Convergence and consistency of recursive least squares with variable-rate forgetting. Automatica 119.](https://doi.org/10.1016/J.AUTOMATICA.2020.109052)
10. [Exponential Resetting and Cyclic Resetting Recursive Least Squares](https://www.researchgate.net/publication/366360322_Exponential_Resetting_and_Cyclic_Resetting_Recursive_Least_Squares)
11. [Recursive Least Squares with Variable-Direction Forgetting, arXiv](https://arxiv.org/abs/2003.03523)
12. [Shin, Lee (2020). A New Exponential Forgetting Algorithm for Recursive Least-Squares Parameter Estimation, arXiv](https://arxiv.org/abs/2004.03910)
13. [Liavas, Regalia (1999). On the Numerical Stability and Accuracy of the Conventional Recursive Least Squares Algorithm. IEEE Transactions on Signal Processing 47(1).](https://www.telecom.tuc.gr/~liavas/publications/On%20the%20Numerical%20Stability%20and%20Accuracy%20of%20the%20Conventional%20Recursive%20Least%20Squares%20Algorithm.pdf)
14. [Square-Root Algorithms of Recursive Least-Squares Wiener Estimators, IFAC 2008](https://skoge.folk.ntnu.no/prost/proceedings/ifac2008/data/papers/0771.pdf)
15. [An Overview of Recursive Least Squares Estimation and Lattice Filters, DTIC ADA137554](https://dtic.minsky.ai/index/ADA137554)
16. [A state-space approach to adaptive RLS filtering, IEEE Signal Processing Magazine 11(3), 1994](https://ieeexplore.ieee.org/document/295229/)
17. [Zaman (2024). Online estimation of PID controllers and plant dynamics via multi-recursive least squares estimation, IET Control Theory & Applications](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cth2.12605)
18. [Efficient Reinforcement Learning Using Recursive Least-Squares Methods, arXiv](https://arxiv.org/abs/1106.0707)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Linear and multilinear algebra › Numerical linear algebra › Least squares and overdetermined systems

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/recursive-least-squares-filter

English original: https://www.edgepedia.org/recursive-least-squares-filter
