Jump to content

Nonlinear Curve fitting for Complex Data


Recommended Posts

Cross-post disclosure: http://forums.ni.com/ni/board/message?board.id=170&thread.id=428823

I am trying to fit some rectangular complex data (S11 data for those with network analyzers) to a model using the Constrained Nonlinear Curve Fit vi in LabVIEW using the trust-region algorithm. I'm already doing this in Matlab after I've gathered and saved all my data, but would like to bring it into LabVIEW. (Doing the fitting in Matlab has helped me become more proficient in it, distributing and installing two run-times and the executables has become an unnecessary pain.) However, the VI only accepts double, causing me to lose all of the phase information I need to do the extraction. Is there any way to send CDB data or will I have to attempt to rewrite the VI and its sub-VIs, replacing DBL with CDB?

Thanks,

Chris

Link to comment

Hi Cris,

I am guessing that in your matlab code you minimize the square of the distance of experimental and theoretical values. This means, you are minimizing the sum: "sum of (Re_theortical - Re_experimental)^2 + (Im_theoretical - Im_experimental)^2).

This means that you should be able to easily implement this with reals only: Arrange your experimental data for example such that y0=Re(z0) and y1=Im(z0), y2=Re(z1), y3=Im(z1), .... and the acquisition times are t0, t0, t1, t1, .........

Now, what you have to do is write your fitting function such that it computes the real part of the theoretical function for even indeces and the imaginary part when the index is uneven. In terms of speed, I would use a case structure and toggle between false and true.

Then, if it is possible to calculate the derivatives analytically, I would code them in the same manner.

Maybe, this description is a little short but please ask again, if I am not clear enough.

Herbert

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.