每个人。我正在尝试使用系统识别工具箱构建噪声模型。
我的系统可以写成:y = C(z)/D(z) e。基本上,我测量系统响应 y 纯粹是由于未测量的白噪声e。我认为系统 ID 可以完成这项工作,因为它只是一个ARMA模型。
在将其应用于实际数据之前,我编写了以下测试脚本,该脚本模拟了具有白噪声输入的已知系统,并尝试使用响应 y 来获得估计模型,并通过绘制它们的波数将其与已知模型进行比较。我的问题是估计的波特与真实的形状相同,但直流增益却非常不同。有人可以阅读我的脚本并告诉我出了什么问题吗?谢谢你!
close all; close all;
wn = 10;
sys = tf([wn^2], [1, 2*0.9*wn wn^2]);
% discretize;
Ts = 0.025;
sysdt = c2d(sys, Ts);
Fs = 1/Ts;
Tn = 4;
N = Tn/Ts;
Tsim = (0:N-1)' * Ts;
whitenoise = randn(N, 1);
Y = lsim(sysdt, whitenoise, Tsim);
%the "input" u is 0, we have only noise e
td_data = iddata(Y, zeros(size(Y)), Ts);
%% estimate use different commands
%1.armax model: A(q) y(t) = B(q) u(t-nk) + C(q) e(t)
% syntax: M = armax(data, [na, nb, nc, nk]
idout_armax = armax(td_data, [2, 0, 1, 1]);
idsys_armax = tf(idout_armax.c, idout_armax.a, Ts);
figure, bode(sysdt, idsys_armax)
legend('true model', 'armax')
%2. Box_Jenkins: y(t) = [B(q)/F(q)] u(t-nk) + [C(q)/D(q)]e(t)
% b+1 c d f k
idout_bj = bj(td_data, [1, 1, 2, 1, 0]);
idsys_bj = tf(idout_bj.c, idout_bj.d, Ts);
figure, bode(sysdt, idsys_bj)
legend('true model', 'box jenkins')
%3. If I use the whitenoise data as input *u* , I can get correct DC gain with oe (most of the time).
td_data_wn = iddata(Y, whitenoise, Ts);
% OE model: y(t) = [B(q)/F(q)] u(t-nk) + e(t)
% nb nf nk
idout_oe = oe(td_data_wn, [1, 2, 0]);
idsys_oe = tf(idout_oe.b, idout_oe.f, Ts);
figure, bode(sysdt, idsys_oe), legend('sysdt', 'idsys oe')