Showing results for 
Search instead for 
Did you mean: 

3D fitting surface



I have a 3D geometry like in the picture attached. How is it possible to make a 3D fitting plane and use that afterwards instead of this noisy 3D signal? I read about it a bit and found interesting infos like this one


but I couldn't really get it right how I could use that with my problem. Any thoughts how it is done, I could not find any VI in the libraries that would do 3D fitting.




0 Kudos
Message 1 of 7

Can I have some advice on this topic please.

0 Kudos
Message 2 of 7

Hi Krivan,


It looks like you're most the way there; just to confirm, are you looking to effectively remove everything from the bottom graph that is not shaded in red? Could you upload the data and the VI that you're currently working with so we can help further?


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

0 Kudos
Message 3 of 7

Hi Imtiaz,


I would upload the VI but I had to realise that it wouldn't lead me to the solution. Basically what I did was a peak-search. I systematically tried to replace those spikes with predefined values. Say if i[1] and i[3] was OK but i[2] had a very different value, the i[2] was replaced by (i[1]+i[3])/2 so that the 3D geometry could keep its slope. So I tried this but didn't really work out. 


Also tried Altenbach's approach referenced above but it wasn't really obvious for me how I could include my data into that VI.


Sure, I'll upload soon, I am just not at those computers.


What I try to achieve is that from this noisy data I create a fitted 3D geometry that follows the slope of the original data but does not have any of those spikes. I also thought about a 2D approach as well. So I have a 2D dataset in a TDMS file that after read-in can be considered as 3D. Now, if I systematically read out this 3D array in a way that I sample the same data points from the pages along the 3D array in theory I would get a 1D array at each read-out cycle that I can feed into a Waveform graph.

Therefore I imagined that I could feed this curve into a "fitting curve" VI from the library and the fitted result will be a fitted curve, i.e. a fitted 1D array with the same number of elements as the original one.

This fitted array I could put back into the 3D array and so after a number of cycles at the end I would get a "fitted 3D array".


However I think it would work only in theory because it would require too much computations and would last too long.


Any suggestions perhaps how it is done efficiently?

0 Kudos
Message 4 of 7



I managed to get considerable less noise in the data however I still don't know how to fit a 3D plane to this data.

I attached a TDMS file and a VI to make it easier to open the data.




0 Kudos
Message 5 of 7

Your 2D array is surrounded by zeroes, I assume you don't want to fit those.

How about fitting to a 2D polynomial?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 7

Yes, it is surrounded by zeros because I simply chopped off some problematic artifacts from the sides.

As I've said above I have tried your solution with the LS and L-Marq. algorithms but I couldn't get it right how I should feed in the data and how the coefficients are calculated [I haven't had any practice with polynomial fitting before].


Did you mean with the 2D polynomial fitting that the TDMS file contains a 2D array anyway, so if the data is 2D fitted and I wire it into the 3D graph the result will be a fitted 3D plot?

0 Kudos
Message 7 of 7