[Prediction model] data prediction based on matlab RLS algorithm [including Matlab source code 222]

1. Introduction

1 Overview
Recursive Least Squares (RLS) algorithm is a typical data processing method. It was proposed by the famous scholar Gauss in 1795. Gauss believed that when inferring unknown parameters based on the obtained observation data, the most likely value of the unknown parameter is Such a data, that is, it minimizes the sum of the square of the difference between the actual observation value and the calculated value multiplied by the value measuring its accuracy. This is the famous least square. The recursive least squares (RLS) algorithm is widely used in signal adaptive filtering analysis. The recursive least squares (RLS) algorithm has a fast convergence speed and is insensitive to the dispersion of the eigenvalues ​​of the autocorrelation matrix. However, its computational complexity is large. This chapter The main research is based on RLS data prediction and MATLAB realization.
2 Basic principle and process of
Insert picture description here
RLS algorithm 3 RLS algorithm process
Insert picture description here

Second, the source code

clc,clear,close all
warning off      % 消除警告
N = 1000;        % 信号观测长度
a1 = 0.99;       % 一阶AR参数
sigma = 0.0731; % 加性白噪声方差
for kk =1:100
    v = sqrt(sigma)*randn(N,1); % 产生v(n)加性白噪声
    u0 = [0];      % 初始数据
    num = 1;       % 分子系数
    den = [1,a1];  % 分母系数
    Zi = filtic(num,den,u0);    % 滤波器的初始条件
    un = filter(num,den,v,Zi);   % 产生样本序列u(n), N x 1 x trials
%     figure,stem(un),title('随机信号');grid on;
    % 产生期望响应信号和观测数据矩阵
    n0 = 1;          % 虚实现n0步线性预测
    M = 2;           % 滤波器阶数
    b = un(n0+1:N);  % 预测的期望响应
    L = length(b);  
    un1 = [zeros(M-1,1)',un'];  % 扩展数据
    A = zeros(M,L);
    for k=1:L
        A(:,k) = un1(M-1+k : -1 : k);   % 构建观测数据矩阵
    end
    % 应用RLS算法进行迭代寻优计算最优权向量
    delta = 0.004; % 调整参数
    lamda = 0.98;  % 遗忘因子
    w = zeros(M,L+1); 
    epsilon = zeros(L,1); 
    P1 = eye(M)/delta;
    % RLS迭代算法过程
    for k=1:L  
        PIn = P1 * A(:,k);
        denok = lamda + A(:,k)'*PIn;
        kn = PIn/denok;
        epsilon(k) = b(k)-w(:,k)'*A(:,k);
        w(:,k+1) = w(:,k) + kn*conj(epsilon(k));
        P1 = P1/lamda - kn*A(:,k)'*P1/lamda;
    end
    w1(kk,:) = w(1,:);
    w2(kk,:) = w(2,:);
    MSE = abs(epsilon).^2;
    MSE_P(kk) = mean(MSE);
end

Three, running results

Insert picture description here
Insert picture description here

Four, remarks

Complete code or writing add QQ1564658423 past review
>>>>>>
[prediction model] lssvm prediction based on matlab particle swarm [including Matlab source code 103]
[lSSVM prediction] based on matlab whale optimization algorithm lSSVM data prediction [including Matlab Source code 104]
[lstm prediction] Improved lstm prediction based on matlab whale optimization algorithm [including Matlab source code 105]
[SVM prediction] Improved SVM prediction based on matlab bat algorithm (1) [Containing Matlab source code 106]
[ SVM prediction 】Based on matlab gray wolf algorithm to optimize svm support vector machine prediction [including Matlab source code 107]
[Prediction model] based on matlab BP neural network prediction [including Matlab source code 108]
[lssvm prediction model] based on bat algorithm improved least squares Support vector machine lssvm prediction [Matlab 109 issue]
[lssvm prediction] Least squares support vector machine lssvm prediction based on moth extinguishing algorithm improved [Matlab 110]
[SVM prediction] Improved SVM prediction based on matlab bat algorithm (two ) [Include Matlab source code 141 period]

[Lssvm prediction] improved least squares support vector machine lssvm prediction based on matlab moth fire fighting algorithm [including Matlab source code 142]
[ANN prediction model] based on matlab difference algorithm to improve ANN network prediction [including Matlab source code 151]
[ Prediction model] based on matlab RBF neural network prediction model [including Matlab source code 177 period]
[Prediction model] based on matlab SVM regression prediction algorithm to predict stock trends [including Matlab source code 180 period]
[prediction model] based on matlab BP neural network model optimization Prediction [including Matlab source code 221 period]

Guess you like

Origin blog.csdn.net/TIQCmatlab/article/details/113692956