Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Cwstat1.ExpFit returns wrong results

Hello,
   
  The following routine using Cw1stat.expfit returns wrong results. Any Idea?
 
Cem
 
Public Sub Fit(x as variant,y as variant)
  Dim i As Variant, amp As Variant, decay As Variant, mse As Variant
  Dim  z As Variant
    
 CWStat1.ExpFit x, y, z, amp, decay, mse
 
     For i = 0 To UBound(x)
        Debug.Print i, x(i), y(i), z(i)
    Next
 
    Debug.Print amp, decay
 
End Sub
 
Data
x=   10, 14, 17, 20, 23, 28, 31
y= 162, 269.5, 245, 245, 550,1372, 2025
Wrong Results
 10    162         127.532 
 14    269.5        207.63
 17    245         299.270 
 20    245         431.346 
 23    550         621.711 
 28    1372        1143.383 
 31    2025        1647.98
 
amp=37.706       decay= 0.1218
Correct Results
10  162  80.9
14  269.5  149.7
17  245  237.6
20  245  377
23  550  598.3
28  1372  1291.8
31  2025  2050
amp=17.3455  decay=    0.1539
0 Kudos
Message 1 of 5
(7,227 Views)

Girit, I have plotted your solution graphically.

Results correspond to “Wrong Results”.

I think the solution is correct.

Why you consider, what the received results are wrong?

 

Yours respectfully,

Vladimir Sotin

0 Kudos
Message 2 of 5
(7,216 Views)

Vladimir,

    I tested the results against Matlab and SigmaStat. Both produced results exactly the same and with better mse. If you plot what I call the correct results you will see the difference. Thank you anyhow.

Cem

 

 

0 Kudos
Message 3 of 5
(7,211 Views)
Hi Girit,
 
I tested out that CWStat method and it worked just as you mentioned in your post. The results that were returned are correct based upon our algorithm. Perhaps those other languages are using different algorithms. If you launch the Measurement Studio Help (Start >> Programs >>  National Instruments >> Measurement Studio >> Help >> Measurement Studio Reference) and then type in CWStat in the Index tab, you can go the a page that displays all the different methods for that ActiveX control. Select the ExpFit method and you will see the algorithm we use. 
 
Hope this helps!

Best Regards,
 
Jonathan N.
National Instruments
0 Kudos
Message 4 of 5
(7,198 Views)

Girit, I have plotted the correct results graphically.

Really, the plot looks better. It better represents the data points.
 
All the best,
Vladimir Sotin
0 Kudos
Message 5 of 5
(7,189 Views)