GP-OLS线性参数动态输入输出系统的模型结构识别(Matlab代码实现)

 ?????个人主页:研学社的博客   

????????欢迎来到本博客????????

??博主优势:??????博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

??座右铭:行百里者,半于九十。

??????本文目录如下:??????

目录

??1 概述

??2 运行结果

2.1 算例1

2.2 算例2 

??3 参考文献

??4 Matlab代码实现


??1 概述

遗传编程(GP)从输入输出测量数据生成动态系统的非线性输入输出模型。该GP-OLS工具箱应用正交最小二乘算法(OLS)来提高GP的搜索效率。
它可用于静态方程发现或简单动态线性参数模型(即NARX模型,多项式模型等)的结构识别。

??2 运行结果

2.1 算例1

2.2 算例2 

部分代码:

% Simple example for GP-OLS
%  Dynamical input-output model identification
% (Append the GpOls directory to the path)
%

clear all

%Simulation of a dynamic system and generates input/output data
t = [0:0.2:20]';
u = sin(t/2)-0.5;
u = u + randn(size(u))*0.1;
y = zeros(size(u));
y(1) = 0;
y(2) = 0;
for k = 3:length(t),
  dy = 0.7*u(k-1)*u(k-1) - 0.6*y(k-1) - 0.3*y(k-2) - 0.1;
  y(k) = y(k-1) + dy;
end
%Adds some simulated 'measurement noise' to the output
y = y + randn(size(y))*0.02;

%Select the maximum input and output order for identification
uorder = 2;
yorder = 2;

%Regressors and outputs for identification
tofs = max(uorder,yorder)+1;
Y = y(tofs:end) - y(tofs-1:end-1); %dy
X = [];
for  i=1:yorder,
  X = [X, y(tofs-i:end-i)];
end
for  i=1:uorder,
  X = [X, u(tofs-i:end-i)];
end

%GP equation symbols
symbols{1} = {'+','*'};
for i = 1:yorder,
  symbols{2}{i} = sprintf('y(k-%i)',i);
end
for j = 1:uorder,
  symbols{2}{i+j} = sprintf('u(k-%i)',j);
end

%Initial population
popusize = 40;
maxtreedepth = 5;
popu = gpols_init(popusize,maxtreedepth,symbols);

%first evaluation
opt = [0.8 0.7 0.3 2 2 0.2 25 0.01 1 0];
popu = gpols_evaluate(popu,[1:popusize],X,Y,[],opt(6:9));
%info
disp(gpols_result([],0));
disp(gpols_result(popu,1));
%GP loops
for c = 2:20,
  %iterate 
  popu = gpols_mainloop(popu,X,Y,[],opt);
  %info  
  disp(gpols_result(popu,1));
end

%Result
[s,tree] = gpols_result(popu,2);
disp(s);

??3 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]聂黎雯.变系数模型的稳健变量选择与结构识别[J].兰州文理学院学报(自然科学版),2022,36(04):15-19.DOI:10.13804/j.cnki.2095-6991.2022.04.001.

[2]János Madár (2023). GP-OLS model structure identification

??4 Matlab代码实现