01-14-2014 06:17 PM
I have this multidimensional fit VI that works it is taking about 30 seconds for the waveform to fit. Does anyone have any suggestion of making it faster?
In my 2D Gaussian Model I have the 2D gaussian equation with 2 forloops, this is taking about 1 whole seconds for it to calculate and might be the reason it is slowing the code down is there a different way of having this exact model?
Thanks.
01-14-2014 07:54 PM
Your model VI repeats many calculations unnecessarily. The image below was taken with "constant folding" turned on. The fuzzy lines are value which do not change within one iteration of the loop. Therefore, all that should be moved outside the loop. Why calculate it a million times when a thousand will do?
Then I looked at other things and found a few more repetitions which could be avoided. For example the size of the output array can be calculated from Width x Height. No need to measure the size of the 2D array.
The attached Model VI seems to run in about 2/3 the time of the original.
Lynn