System identification
using MATLAB Signal Processing Toolbox functions lmc, prony and stmcb lab13_6.m * mw * 05/09/2007
Contents
Input parameters
Nz = 8; Np = 8; % number of zeros and poles for system model Nh = 20; % computed length of impulse responses for comparison K = 50; % simulated length of system response
System under test and filtering
b = [.2317 .3378 .5297 .3378 .2317];% numerator a = [1 -.3396 1.2275 -.3119 .2964]; % denominator % b = 1; % all-pole system h = impz(b,a,Nh); % impulse response fvtool(b,a) x = zeros(1,K); x(1) = 1; % impulse y = filter(b,a,x); % simulated output signal of system under test randn('state',0); n = 0.1*randn(size(y)); % AWGN y = y + n; % + AWGN
MA Model
[a_lpc g] = lpc(y,Np);
fvtool(1,a_lpc)
[b_prony,a_prony] = prony(y,Nz,Np);
fvtool(b_prony,a_prony)
[b_stmcb,a_stmcb] = stmcb(y,Nz,Np); % impulse response
fvtool(b_stmcb,a_stmcb)
Display and graphics
fprintf('lab13_6 lpc/prony/stcmb system identification \n') fprintf('No. of zeros = %g No. of poles = %g\n',Nz,Np) h_lpc = impz(1,a_lpc,Nh)*h(1); % scale h_prony = impz(b_prony,a_prony,Nh); h_stmcb = impz(b_stmcb,a_stmcb,Nh); fprintf('Impulse responses\n') fprintf(' System lpc prony stmcb\n') for n=1:Nh fprintf('(%2i) %+10.6f %+10.6f %+10.6f %+10.6f\n',n,h(n),h_lpc(n),h_prony(n),h_stmcb(n)) end fprintf('TSE %10.6f %10.6f %10.6f\n',sum((h-h_lpc).^2),sum((h-h_prony).^2),sum((h-h_stmcb).^2))
lab13_6 lpc/prony/stcmb system identification
No. of zeros = 8 No. of poles = 8
Impulse responses
System lpc prony stmcb
( 1) +0.231700 +0.231700 +0.188444 +0.188444
( 2) +0.416485 +0.044618 +0.249927 +0.228959
( 3) +0.386727 -0.020902 +0.399260 +0.433646
( 4) +0.030164 -0.005199 +0.058932 +0.029565
( 5) -0.171537 -0.003109 -0.286185 -0.181774
( 6) -0.098106 +0.007624 +0.020985 -0.015631
( 7) +0.072028 -0.010044 +0.190944 +0.217081
( 8) +0.082443 +0.010382 +0.078680 -0.039919
( 9) -0.040172 +0.004304 -0.007443 -0.077102
(10) -0.063297 -0.002862 +0.040132 -0.106377
(11) +0.032180 -0.000227 +0.032634 +0.080193
(12) +0.051660 -0.000850 -0.048311 -0.057971
(13) -0.029793 +0.001318 -0.039852 -0.074352
(14) -0.044732 -0.000875 -0.017874 +0.142517
(15) +0.027954 +0.000181 -0.019639 +0.009059
(16) +0.039797 +0.000512 -0.014279 +0.028527
(17) -0.025920 -0.000265 +0.004683 +0.027369
(18) -0.035676 +0.000038 +0.015881 +0.020121
(19) +0.023828 -0.000126 +0.011315 -0.086442
(20) +0.032004 +0.000122 +0.010779 -0.054064
TSE 0.375341 0.104056 0.162755
stmcb with input signal
K = 2000; INT = 3; x = randn(1,K); % white noise y = filter(b,a,x); % simulated output signal of system under test randn('state',0); n = 0.1*randn(size(y)); % AWGN y = y + n; % + AWGN [b_stmcb2,a_stmcb2] = stmcb(y,x,Nz,Np,INT); % impulse response fvtool(b_stmcb2,a_stmcb2) h_stmcb2 = impz(b_stmcb2,a_stmcb2,Nh); fprintf('Impulse responses (INT=%2i)\n',INT) fprintf(' System stmcb2\n') for n=1:Nh fprintf('(%2i) %+10.6f %+10.6f\n',n,h(n),h_stmcb2(n)) end fprintf('TSE %10.6f\n',sum((h-h_stmcb2).^2))
Impulse responses (INT= 3)
System stmcb2
( 1) +0.231700 +0.230860
( 2) +0.416485 +0.419254
( 3) +0.386727 +0.388280
( 4) +0.030164 +0.029701
( 5) -0.171537 -0.165585
( 6) -0.098106 -0.096824
( 7) +0.072028 +0.069302
( 8) +0.082443 +0.081491
( 9) -0.040172 -0.039345
(10) -0.063297 -0.066773
(11) +0.032180 +0.028943
(12) +0.051660 +0.052099
(13) -0.029793 -0.028301
(14) -0.044732 -0.045198
(15) +0.027954 +0.028375
(16) +0.039797 +0.040567
(17) -0.025920 -0.026933
(18) -0.035676 -0.036714
(19) +0.023828 +0.025409
(20) +0.032004 +0.032633
TSE 0.000088