"utp" schrieb im Newsbeitrag
news:506500000008000000A35C0000-1031838699000@exchange.ni.com...
> Ben,
> Following is the code of the Resistivity measurement program that i
> had posted a question about.
> Look at the loop in the following position in the program::
> Outermost TRUE frame
> Frame 2
> Frame 2
> Look at the loop taking input from the Q control on the front
> panel.Also the input is taken from another array , F .The program
> first calculates Qa and then searches array Q for the closest value
> and then remembers the index at which the closest value was found and
> from the same position in another array (f)gets a value Fa .Fb is
> calculated similarly.
> This takes foreveR(BUT IS NOT WRONG-JUST TAKES TOO LONG , MY BOSS SAYS
> EARLIER IT DIDNT TAKE SO LONG)
> SO KINDLY HELP
> REGARDS
> UTPAL
Utpal,
concerning the code you mention, Ben's answer is correct, it is a sort of
interpolation which is done in your code.
The calculation is done in an extremely inefficient manner in the code. I
compared it with an optimised code and found that the speed differed by a
factor of 10. The absolute numbers were 12 ?sec for the optimised code and
117 ?sec for the code in your program. But this was under Labview 6.1 on a
2.3 GHz pentium, and you talked about LV 4 (on a probably much slower
machine).
HOWEVER, the calculation speed depends on the value of the input number Qa,
since a long array (roughly 6000 elements) has to be searched through. For
Qa values close to 1 (which you probably have for a "well behaved" van der
Pauw sample) the code in your program takes twice as long as the numbers
above indicate (whereas for a Qa of, say, bigger than 5000 the speed is much
faster).
Now suppose your PC is a factor of 10 slower and suppose further that LV 4
is another factor of 10 slower than LV 6.1 (it is doing lots of 'array
subset' operations in your code) and considering further that the algorithm
is performed 4 times in your program, we might expect a speed of 2 x 10 x 10
x 4 = 800 slower than the numbers above, i.e. 800 x 117 ?sec which is appr,
0.1 sec.
Therefor I believe that the awfully long times you report are not due to
this (admittedly very inefficient piece of) math code.
I attach 2 png pictures, showing
a) the optimised code
b) how to convert the two big array constants in your code into a form
suitable for the optimised code
You should run b) only once of course and then store array [(Q,f)] in your
program.
If you have access to Labview 6.0 or 6.1, I could also send you the code
directly.
-Franz
[Attachment Calculate interpolated f(Q)d.png, see below]
[Attachment Make Q,f arrayd.png, see below]