Created
June 30, 2016 08:59
-
-
Save YoshiRi/87fadfd20f94cdcfde17fa25ac44691b to your computer and use it in GitHub Desktop.
RLS function for MATLAB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Cta, Pn, Rn] = rls_const_func(Cta_,Pn_,Rn_,Yn ,Zn) | |
%% forgetting factor (Time varying) | |
Rn = (1 - 0.01)*Rn_ + 0.01; | |
%% function | |
Num = Rn+Zn'*Pn_*Zn; | |
Pn = 1/Rn*( Pn_ - (Pn_ * Zn * Zn' * Pn_/Num) ); | |
Ln = Pn_*Zn /Num; | |
En = Yn - Zn.' * Cta_; | |
%% Output | |
Cta = Cta_ + Ln * En; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment