LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Spline Interpolation failes because of "undistinct" data

Hi all!

 

I have the following problem:

I measure an distribution density and calculate corresponding cumulative distribution function of the measured data. Now I need to know some specific x-values, for example where is the CDF at 50%. To do that, I tried to interpolate the CDF with SpInterp() with interchanged X and Y-arrays. Befor I can use SpInterp() I need to calculate the second derivatives with Spline(). But Spline() gives me allways a runtime error, because the x-values must be distinct. I get the same problem with PolyInterp(). RatInterp() works, but gives sometimes very bad results, so it's not usable in this case.

 

Has anyone an idea?

 

Best regards,

Thomas

0 Kudos
Message 1 of 3
(4,662 Views)

Hi!

 

you measure a distribution density, so I figure the x-value are distinct, the y values are not. You get that problem by interchanging the arrays.

 

So, I suggest you don ´t do that.

 

If you look for the x-value for y=Y0 for instance:

 

Take your y-values and subract Y0, you get a zero crossing at for Values around Y0. Intergrate and you get a local maximum/minimum. That should be easy to detect.

 

Regards

René

0 Kudos
Message 2 of 3
(4,607 Views)

Hi René,

 

good idea. I will try it out and compare it with my current solution.

 

I solved it this way: I interpolate the sum distribution to increase the resolution by 100. Then I can easily step through my array and find my y-values with sufficient accuracy.

 

Regards,

Thomas

0 Kudos
Message 3 of 3
(4,598 Views)