07-10-2019 02:01 AM
Hai DSPGuy.....
As you said, with the equation and guess initial values a curve is coming but its starting at around 23.5. I tried adjusting the initial guess values curve is changing.
I used u=-93.46,t1 =70u sec ,t2=0.4u sec.
Anyway i am getting a curve with my required equation. That' good.
When i am changing t1 and t2 there is no change but if you change u curve is changing (which is not required to me). As a said is there any chance of getting Curve start point at zero ?
Tq u so much for your help...
07-10-2019 10:55 AM
Why are you passing the Y values into the weight array? The weights should be positive, and to ensure that the nonlinear curve fit.vi takes the absolute value of the array. If you look at the magnitude of your Y values near t=0 they are much smaller than most of the rest of the curve, which means the fit error near these points is not weighted as heavily. If you simply don't wire the weight array input then a constant weighting of 1 for all points is used. By doing this the best fit curve value at t=0 is about 8.75 instead of 23.5. Better, but not zero. If you create a weights array (same size as Y) and make all the values 1 except for a few at the beginning that are larger than 1 (say 10 to start), then you can bias the fit to reduce the error at these points at the expense of larger error elsewhere. I played around with your data, and if I weight all points with 1 except for the first point which is weighted at 1E5 ( weight = [1E5, 1, 1, ... 1] ), then I see a y-intercept value of 0.0017.
Although you can bias the fit using the weight input there is a larger issue with your model. There are two separate solutions if you force it to pass exactly through the origin:
u=0 or t1=t2
Both would mean the entire curve is zero (horizontal line). I think you can get close to a y-intercept of zero using the weight input, but cannot be exactly zero without changing your model slightly.
-Jim
07-10-2019 11:31 PM - edited 07-10-2019 11:48 PM
Thank You DSPGuy thank you very much....As u said start point is coming from 0.0017. Can be acceptable...But why Weight value first point is 1E5 ?.I will approach you if i am got strucked any where..
Thanking you all...
07-11-2019 03:33 PM
"But why Weight value first point is 1E5 ?"
I'm not sure I understand your question. The residue is computed as follows:
The residue is the value that is minimized by the Nonlinear Curve Fit.vi. If all the weights are 1 then each error ( y-f(x) ) between a data point and the best fit curve contributes equally to the residue. Your first data point is (0,0), and you stated that you want the curve to pass through or nearly through this point.
I started with a weight array of all 1's, and then gradually increased the weight of the first point, causing the best fit curve to move closer to this point. There is nothing special about 1E5 except it is a value that still gave reasonable agreement between data and model and allowed the model to be close to the origin, at least to my unqualified eye.
As the weight is increased past 1E5 there is an increasingly extreme mismatch between the data and best fit curve. For example, if the weight of the first point is made to be 1E6, then the y-intercept becomes 0.000103819, but the fit over the remaining portion of the curve is significantly worse. If the weight on the first point is increased to 1E30 the y-intercept is even better (-0) but the rest of the curve is more degenerate. My starting parameters are: u=-95, t1=7E-5, t2=4E-7, t3=1E-6.
-Jim