fitting a transfer function from acquired data with tfest
22 views (last 30 days)
Show older comments
Hi,
I would like to fit a transfer function with data I have acquired. I am using the tfest function for this but the function isn't fitting the kind of transfer function I need. I know that my transfer function has the form:
N = [x 0]
D = [a b c d 1]
with this knowlegde I have detailed in the function that I need 1 zero and 4 poles. But tfest doesn't get my nominator right. It always adds a constant in my nominator wich ruins my fit...
can someone help me with this?
thank you!
0 Comments
Answers (1)
Rajiv Singh
on 26 Nov 2012
What do you mean by "nominator"? N or D? Note that IDTF creates transfer functions that have a monic polynomial for the denominator (D). In general, if you want to fix certain entries to their known values, you have to do a multi-step construction:
N = [NaN 0];
D = [1 NaN(1,3), 1];
% say, you want N(2) and D(end) to be fixed.
model = idtf(N,D);
model.Structure.num.Free(2) = false;
model.Structure.den.Free(end) = false;
model = tfest(data, model);
2 Comments
Rajiv Singh
on 27 Nov 2012
Difficult to say why without looking at the data. But fixing parameters can adversely affect the quality of the fit. You may try a free form estimation, get the model with a good fit and then reduce it or transform it to get it in the form you want. You can then even update the coefficients of the final form to improve fit to data.
model1 = tfest(data, Np, Nz);
model2 = some_reduction_of_model1_to_get_desired_form;
model2refined = tfest(data, model2);
The problem usually is bad initialization of the model coefficients by the estimator in presence of constraints. In the code snippet I gave earlier, you can try replacing NaNs with finite values obtained from your own intuition into what those values ought to be. You can then study the effect of initial guesses on the quality of the final results and perhaps use that as a guide to converge to good results.
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!