System identification of a resonant system

434 Views Asked by At

I want to write a matlab script that would identify a system from it's inputs and outputs. I have so far had good results with simple systems, but with this slightly more complex one I'm not able to arrive at the original equation. To do identification, I use a chirp signal and collect output data that covers a range of input frequencies. I then use arx() to estimate a transfer function from the input data.

My octave script is as follows:

pkg load signal
pkg load control

s = tf('s');

L = 0.1;
R = 80; 
C = 1e-4;

% Alt2: LC in series, resistor in parallel with output (LRC circuit)
%G = (s * L + 1 / (s * C)) / (R + s * L + 1 / (s * C));

% Alt1: simple RC circuit
G = 1 / (1 + R * C * s);

% simplify G
G = minreal(G)

% number of samples
N = 10000;

% frequency range in hz
Fstart = 15; Fend = 200;

t = linspace(0, 1, N);
sample_time = (t(end) - t(1)) / N

% generate stimulus signal and generate the output data from "real" system
stimulus = chirp(t, Fstart, t(end), Fend)';
[response, T, X] = lsim(G, stimulus, t);

%plot(t, stimulus, t, response, 'r');

% now try to go back to the original transfer function based on the collected data
[Gest, x0] = arx(iddata(response, stimulus, sample_time), 2);
Gest = minreal(d2c(Gest)); [b, a] = ss2tf(Gest); Gest = tf(b, a)

% compare the transfer functions
bode(G, Gest)

input("..");

If I run the script using simple transfer function (Alt1), I'm able to identify the original system precisely using arx (original transfer function G and estimated transfer function Gest are identical):

enter image description here

Short of an error from arx about matrix A being unstable the approximation is 100% accurate (error is due to the fact that I'm using second order approximation on a system Alt1 which is really a first order system so this is irrelevant. If I pass 1 as last argument to arx this error disappears).

However, if I try to do the same experiment with Alt2, which has a resonance at around 25Hz, the method fails:

enter image description here

The estimated transfer function is way off the target.

What is going on? Why am I not able to identify the second system using this method? Is it because I need more data around the resonance? How can I get an accurate estimate of the second system?

1

There are 1 best solutions below

0
On

I think the problem was that arx identification algorithm is just not suitable for solving discontinuous models. I changed algorithm to moen4 with same order and got the perfect solution.

[Gest, x0] = moen4(iddata(response, stimulus, sample_time), 2);

enter image description here