forum.alglib.net
http://forum.alglib.net/

Complex Fitting
http://forum.alglib.net/viewtopic.php?f=2&t=3748
Page 1 of 1

Author:  MarkusG [ Tue May 17, 2016 1:08 pm ]
Post subject:  Complex Fitting

Hello,
I am using the alglib in Python. My task is, to identify the parameters of a transfer function from frequency response measurement. By the frequency response measurement I get a complex vector (real and imaginary part) and a frequency vector. Is it possible to find a complex transfer function that fits the measured data (Complex curve fitting)?

I already tried to fit a transfer function to the amplitude frequency response. It worked well with the non linear least square solver. (I edited the example "lsfit_d_nlf example" ). But now I want to do a complex fitting.

Does anyone have a solution for my problem? I am very grateful for any help.


Best regards
Markus

Author:  Sergey.Bochkanov [ Wed May 18, 2016 10:26 am ]
Post subject:  Re: Complex Fitting

ALGLIB does not support complex fitting directly, but you may implement it indirectly using ALGLIB optimizers. Complex value, after all, is just a pair of real values (x,y), so you may replace N-dimensional complex problem by equivalent 2N-dimensional real valued one.

Mathematics of the target function shows similar two-fold increase in size. During fitting you multiply complex residuals by their conjugates, so in original formulation you have a term like residual_i*conj(residual_i). In the real-valued formulation, you have equivalent residual_i_x*residual_i_x + residual_i_y*residual_i_y. So, in original formulation you had M squared summands, now you have 2M squared summands.

I recommend you to use minlm subpackage, because it is flexible enough for the task you want to solve. lsfit is explicitly tied to real valued fitting and can not be used for tasks like this.

Author:  MarkusG [ Thu May 19, 2016 2:23 pm ]
Post subject:  Re: Complex Fitting

Hey Sergey,
I had check how the minlm subpackage work. But after getting familiar with it, I was able to solve the task.
Thanks a lot for your help.

Best Regards
Markus

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/