2014-01-14 88 views
1

大家好。我正在尝试使用系统识别工具箱建立一个噪音模型。matlab系统识别工具箱给我错误的直流增益传递函数

我的系统可写为:y = C(z)/ D(z)e。基本上我测量系统响应y纯粹是由于未测量的白噪声e。我认为系统ID会完成这项工作,因为它只是一个ARMA模型。

在将其应用于实际数据之前,我编写了以下测试脚本,它使用whitenoise输入模拟已知系统,并尝试使用响应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') 

回答

1

我发现了用于DC增益的可能的原因由自己:

的系统识别工具箱给出噪声方差的估计。因此,尽管我使用方差为1的randn生成了我的数据,但工具箱会假设(估计)另一个噪声方差,我应该用它来缩放我的估计传递函数以获​​得正确的直流增益。

所以,如果在上面的代码中,ARMAX模型估计的一部分,我用

idout_armax = armax(td_data, [2, 0, 1, 1]); 
scale = sqrt(idout_armax.NoiseVariance); 
idsys_armax = tf(idout_armax.c, idout_armax.a, Ts)*scale; 
figure, bode(sysdt, idsys_armax) 

直流增益应该(几乎)比赛的时候。

我希望这是正确的原因。

+0

这个问题仍然有效吗? – hyprfrcb

相关问题