03-07-2014 10:30 AM
I am trying to use the non linear fit vi, and the fit is not even close. am I doing something wrong? Two questions.
1. When using static VI reference, is it possible to input a path from the block diagram?
2. For curve fitting, is there a way to put a constrain on what the parameters estimates are? For example, they can't be negative.
Thanks!
03-07-2014 11:55 AM
You need to be careful with the Levenberg-Marquardt algorithm. If your initial conditions are not close to the actual solution, it will not not minimize the error function. This is often true when there are multiple maxima and minima.
03-07-2014 01:47 PM
jyang72211 wrote:1. When using static VI reference, is it possible to input a path from the block diagram?
If you want to change the model dynamically by file name, you need to simply open a VI reference in the old fashioned way (Same way we did before static VI references were available).
(I haven't looked at your code, have to attend a meeting.)
03-07-2014 02:10 PM - edited 03-07-2014 02:21 PM
My quick test is to set the max iterations to 0 so the initial guess becomes the best fit and tweak the input parameters. I usally stare at the formula (the x=0 point and the limiting values are good places to start) and estimate how the parameters effect the curve. Then I try to find the order of magnitude for a starting guess.
My guess of {100,1,1,0,0.1,10} gives a decent looking curve, but I have no idea what the values should be. C does go negative, I think it has to BTW otherwise there is a pole in your region which the data does not reflect.
Edit: G does represent a lot of things quite well, math is not one of them. Put a comment on your formula VI BD with the formula on it!
03-07-2014 03:48 PM - edited 03-07-2014 04:38 PM
I think the fitting would be more easy to follow if you would use log(current) as x (or simply use logarithmic mapping for the x-axis)
Still the curve looks like rather featureless banana and it is hard to imagine that you could get 6 uncorrelated parameters out of it. What is the error in the data?
03-07-2014 04:25 PM
In any case, the model seems to have way too many parameters, for example C vs. MPU and B vs. TM are 100% correlated, meaning a change in one can be fully compensated by a change in the other. This makes the fitting highly unstable, because there are millions of equally good solutions with widely varying parameters and the algorithm just wanders aimlessly around in the desert.
You need to tighten up the theory and e.g. treat some parameters as constants (e.g. fix at least one of each correlated pair for example).
Where does the data come from? What is the theory behind it?
03-07-2014 04:36 PM - edited 03-07-2014 04:46 PM
Also, it seems that you started out with one of my old examples, but mutiliated it for no clear reason.
Here's how it should look like instead.
03-08-2014 07:13 AM
The data is from a Time Current Curve (TCC) of a relay. Time is the y-axis and current is the x-axis. I know it sounds backwards, but not a typo. It is what a switch uses to decide when to open when a given fault current is present.
I think you are right, maybe some parameters are constant. I will look into this.
03-08-2014 07:17 AM
I did use your old example. I was playing with it in order to check it out, so I probably did things that had no clear reasoning behind it.