01-10-2014 01:42 PM
I am trying to get a multi-dimensional fit working by using a nonlinear curve fit VI and everytime I run it I get an error saying that my samples need to be greater than 0. The specific error message is: "Error: Analysis samples need to be > 0." Does anyone know what is wrong? I have tried to reinitialize my input parameter array to zero, recompile the VI, etc. and still get the same error regardless.
I have attach all my VI's.
Thanks,
Ynessa
01-10-2014 01:51 PM
Can you put some typical values into all controls, make them the default, and attach it once more so we have something to play with? Thanks.
(And please eliminate the local variables in the loops of the model. Just use a wire. Why do all your panels and diagrams fill half of a gigantic screen? I typically like to see more than one panel or diagram at once.)
01-10-2014 03:46 PM - edited 01-10-2014 03:58 PM
For starters, your model uses 8 elements of the paramter array, but you are only giving it 6 ("initial parameter" input). This you need to fix first.
You also need to disconnect the f'(X,a) indicator in the model subVI. What you wire there has nothing to do with partial derivatives and will confuse the fitting algorithm. You cannot arbitrarily re-use that output for e.g. your parameter estimates algorithm. The fitting algorithm expects partial derivatives or an empty array output. If the array is empty, it will calculate numerical derivatives externally. If the output is non-empty, it assumes these are partial derivatives.
01-10-2014 04:21 PM
You also should NOT add noise inside the model. The model needs to be noise-free and purely based on the input parameters. To add noise to the simulation, call the model once, then add noise before fitting.
01-10-2014 09:42 PM
The typical values for the controls are as follow:
Pixel Size (um) = 5.2
x0 (mm) = 640
y0 (mm) = 512
Focal Length (mm) = 1000
Wavelength (mm) = 561
Beam Diameter = 1
Amplitude = 100
Background Amplitude = 10
Width = 1280
Height = 1024
I am farely new to labview and have not figure out the best way, so that my diagrams stay smaller since my width and height are farely large. What do you mean eliminate the local variables in the loops of the model?
01-10-2014 09:56 PM
ytran wrote:I am farely new to labview and have not figure out the best way, so that my diagrams stay smaller since my width and height are farely large. What do you mean eliminate the local variables in the loops of the model?
In the model, you have a hidden indicator called pixel size, which you write once outside the loop and then continuously read over and over again with every iteration of the loops via local variables. SInce the value does not change during the execution of the loops, reading the same indicator over and over is just a waste of efforts. Why involve the UI if the valie is right there in the wire?? The correct way would be to delete that indicator and the local variables and simply connect all by wires.
Did you understand my other comments?
@ytran wrote:
The typical values for the controls are as follow:
Pixel Size (um) = 5.2
x0 (mm) = 640
y0 (mm) = 512
Focal Length (mm) = 1000
Wavelength (mm) = 561
Beam Diameter = 1
Amplitude = 100
Background Amplitude = 10
Are all of those fitting parameters or are some of them constant and known?
01-11-2014 09:27 AM
I am not really sure what you meant about disconnect the f(X,a) indicator in the sub VI model, can you clarify that part.
The pixel size, focal length, wavelength, and beam diameter are known. The focal length, wavelength, and beam diameter will help me calculate the sigma x and sigma y for the fittings.
01-11-2014 11:32 AM - edited 01-11-2014 12:12 PM
You wired the 2D array to the f '(X,a) output. You need to disconnect that wire because it does not make any sense.
Did you understant all my other points?
You still have a mismatch between the number of parameters.
If the pixel size, focal lenght, and wavelength are constants, they cannot be part of the parameter array. You can relay them to the model via the variant data connecter. Just add more elements to the cluster and convert back from variant accordingly.