Using ARX to obtain a transfer function from frequency response data
15 views (last 30 days)
Show older comments
Hi,
I have some complex frequency response data obtained from a measurement. I'm trying to fit a transfer function to this data using the arx function from the system identification toolbox.
However, when I compare the calculated model to the measured data, they don't match very well. Using some knowledge about my system I can calculate the coefficients by hand and this transfer function matches the measured data perfectly. So I'm sure that the system can be approximated by a transfer function of the specified order. As the order of the system is not very high and the measured data is of good quality I think the identification should be better than the results I get, but I can't figure out what I'm doing wrong.
I have included the commands I'm using below. Any help would be very much appreciated. Thanks in advance, Christian
frdobj = idfrd(complexRespData,frequencies,0, 'Units','Hz', 'InputName','In', 'OutputName','Out', 'Name','Z', 'spectrumdata',[]); % create idfrd object from measurement data
modelobj = arx(frdobj,[2 1 0]); % identify. Use 2 poles and one zero.
modeltf = tf(modelobj); % transform to tf
[ident_mag, ident_phase] = bode(modeltf,2*pi*frequencies); % obtain frequency response
model_comp = ident_mag .*exp(1j*ident_phase * pi / 180);
% compare the result to the measured data
figure(1);
loglog(frequencies,abs(complexRespData));
hold on;
loglog(frequencies,abs(model_comp));
0 Comments
Accepted Answer
Rajiv Singh
on 4 Jun 2012
ARX is usually not a good estimator of frequency response data. Please try Output-Error (OE) model which more closely represents a transfer function: y = B/F u + e. Use the OE command for the corresponding estimation as in:
modelobj = oe(frdobj,[1 2]);
You could also try state-space estimation using PEM, as in:
modelobj = pem(frdobj, 2);
If you are using release R2012a of MATLAB, the recommended estimation commands for frequency response data are TFEST (transfer function model), PROCEST (low order transfer function expressed in pole-zero form), and SSEST (state-space model). See:
5 Comments
Rajiv Singh
on 5 Jun 2012
If you have single-input data, try this:
fd = complex(iddata(frdobj))
Now prescribe weights for output samples (fd.OutputData) as a column vector of length equal to lenght(fd.Frequency). Use fd as estimation data.
This is a not convenient workflow for weight assignment and will be improved in forthcoming release.
More Answers (2)
Li Zhijun
on 11 Jun 2012
I have been faced with the same problem as you. I followed your method with same weight, the quality of the fitting is greatly improved. But what do the complex coefficients mean is beyond my knowledge. I am looking forward to further discussion with you and i will search for a better solution or explanation.
lexi11
on 6 Sep 2019
Edited: lexi11
on 6 Sep 2019
Hi,
I am trying to follow your method but when I try the following, I get an error:
data = iddata(signal,[],Ts);
model1 = tfest(data,2,0);
error:
Error using tfest (line 107)
Index exceeds array bounds.
Error in test (line 14)
model1 = tfest(data,2,0);
My system is unknown. I am working on videos so my output is a signal that has pixel brightness values (one value for each frame for one colour channel). The signal is a single colour channel. And I am more interested in finding poles (I don't know how many poles or zeros it has). I tried with indicating zeros as 1 also, same error appears. I don't know what is wrong here.
Any help is appreciated.
Thanks.
1 Comment
rupprechtt
on 3 Nov 2019
Hi,
did you solve the problem? I have the same problem.
Error using tfest (line 107)
Index exceeds the number of array elements (2).
See Also
Categories
Find more on Transfer Function Models in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!