LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to smooth out discontinuous spacial distribution gradients

Hi all.

 

I'm controlling a linear motion device, and need to generate displacement paths for it to obey. What I'd like is to smooth out the 'sharp edges' in my profile data (for example, at points where it may go from a slow forward motion to a faster forward motion). Technically, this is removing the discontinuities in the spacial distribution differential, but in other words all I need to do is "smooth my data".

 

I've mimicked what I want to achieve by putting some hand-created numbers into this graph -->

 

smoothed.jpg

The yellow line is my original profile data. You can see that I'll be moving the device from position 45 at time 0 to position 52 at time 5 and finally position 53 at time 9. This is fine, but I'd like to smooth out the motion a bit and avoid that nasty elbow at time=5 a bit.

The blue line is what I'd like. A smooth run from position 46 at time 0 to position 53 at 9 seconds, that preserves the velocities (gradients of the profile line) at the beginning and end. The reason for this is that the motor will arrive at position 46 (time 0) at the velocity inferred by the first gradient, and will continue beyond position 53 after time=9 at the speed inferred by the end gradient. Therefore I must not change the gradients of the line at the beginning and end.

 

I've tried using the many Signal Filtering techniques LabVIEW has available, but I've found that they create problems:

1. They don't preserve the beginning and end gradients, and

2. They tend not to like the very few sample points I have here. (If I interpolote the yellow line to create intermediate points, the filtering works better, but still suffers from point 1)

 

I've tried using the B-Spline curve fit, but that seems also not to respect the gradients.

 

I've tried the cubic spline fit, but that doesn't return the extra points I need to create the blue curve the way I've shown here.

 

Does anyone have any advice? I thought this would be simple, but I'm a bit stuck now but I suspect that there'll be someone out there that's had to do this too.Naively I expected there to be a simple function called "Smooth Data", but clealy not.

 

Many thanks in advance for any responses received.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 1 of 4
(2,905 Views)

Well, it would seem no-one can help with this?

 

In the meantime I've re-nurtured my academic roots and developed myself a nice algorithm that happily smooths out an elbow defined by three points in space. It uses a proportional tanh relationship for the direction vectors, with a touch of sinusoidal clustering to improve the chord-wise distribution of interpolation points:

 

smooth.jpg

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 4
(2,870 Views)

In my copy of Haliday Resnick and Walker there was a note that talked about Einstein and "working in divine issolation" where he was not distracted by others telling what was leagl and what wasn't. I recall that note when I propose idea like the following that some math type will tell me has not physical meaning and dismiss it off-hand. But since I don't limit myself to what is allowed or legal...

 

See this thread starting a post #5.

 

Summary:

 

CC's best attempt at smoothing the curve was shown in this plot.

 

 

Using my non-legal technique, I got these results.

 

 I a nutshell:

 

When yo ufilter you loose data at the front and back-end with the number of points of data loss being determined by the order of the filer. By first pre-pending and appending the same data set reflected about the first and last point, we trick math into telling us what it woudl refuse to tell us otherwise.

 

maybe this will help you,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 4
(2,866 Views)

Hi Ben,

 

I totally agree with your philosophy! Just because an apparent solution has no mathematical hypothesis behind it does not necessarily make it unacceptable. The 'proof of the pudding is in the eating', so try it, and if it works then consider it successful.

 

Yes, I have heard of end-effect preventative measures, including artificially extending the dataset to include 'buffer' data at the beginning and end to absorb the end-effects. I didn't expect that to work for me, however, for I have only three data points that define two straight lines, and wish to define a curve that effectively gives me back a greater number of points (in my case, 16).

A low-pass filter applied to three data points (or 5 if you add end-buffers) still doesn't quite smooth out the elbow unfortunately. Not that I could successfully achieve anyway.

 

Thanks for the reply,

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 4 of 4
(2,855 Views)