01-06-2009 11:48 AM
I am trying to fit an equivalent circuit model to measured data. The data is a standard DC family of curves where the x-axis is the drain voltage and the y-values are drain currents for multiple gate voltages. Thus the function will depend on the drain voltage and the gate voltage to determine the drain current.
I have searched the examples and message boards and only found some very confusing examples of Lev-Mar multivariate fitting. I have done this in Excel with the solver, but Excel tends to crash and is slow. The measured data is in text format and I have made a manual fitting routine in Labeled. I hope to convert it to an automated optimizer.
Thanks,
Fred
01-06-2009 11:58 AM
Over the years, I posted quite a few examples and I don't think they are too difficult. So let's simply clear up the confusion instead. 😄
Do you have some typical data and a detailed description of the model? How many fitting parameters do you have?
01-06-2009 02:05 PM
I have example data and can provide an example equation showing what the parameters are. There are roughly variable parameters that are adjusted to fit the data.
Here is a very shortened form:
Id=P1*(tanh(P2*Vd/(P1*(1-P3*(Vg)))));
I pulled most of the equation to keep it simple.
Again, Vd and Vg are independent variables and P1 - P3 are the constants I want to adjust to fit the measured data.
I can send a picture of what the measured data plot looks like if you need it.
Thanks,
Fred
01-06-2009 02:24 PM
01-06-2009 04:10 PM - edited 01-06-2009 04:11 PM
I did a quick modification of my old NI-Week Demo (using simulated data) and the fit seems to work quite well.
Here's an example fit:
Here's the code of model subVI:
All you need to do is add some code to read in real data. 🙂
Let me know what LabVIEW version you have and I attach the code.
01-06-2009 04:18 PM
I have version 7.1 here...we have newer versions in the lab.
I have been tied up this afternoon....
thanks
01-06-2009 04:53 PM
01-07-2009 05:57 AM
I have reviewed you code and the light turned on! I kept trying to pass Vd and Vg into the equations. You still use "X" and use it to index the data. I will give this a try!
Thank you very much,
Fred
01-07-2009 10:09 AM
Yes, fortunately the size of the x array does not need to match the size of the z array, so all you need to do is make sure that your function has all the x and y data one way or another. One possibility is to interleave the two in the toplevel program and then split them again using "decimate array" in the model (as I did). You could equally well append the two and then split the array later. As long as it is a 1D array and both sides know how things are arranged, you're fine.
Another possibility would be to not even use the x-array input, but send the x and y arrays via the "data" variant.
All you need is a model VI that generates a Z array to be compared with a matching Z array of your experimental data based on the fitting parameters. 🙂