Showing results for 
Search instead for 
Did you mean: 

Smoothing saw tooth in 1 array

I have an array and I show it on a graph. I am trying to smooth my coordinates on a graph.I tried a few ways but it changed the shape of the array I wanted. Is there any way to solve them?

Thank you very much !1.pngPosition to be smoothed2.pngThe coordinates are smooth but the shape has changed

0 Kudos
Message 1 of 5

The code i'm testing.

0 Kudos
Message 2 of 5

I'm not surprised that the shape has changed!  Look at your code -- I believe it is "doing what you asked it to do, but not doing what you want it to do".


You have an array of X,Y pairs that represent successive points on a figure.  What do you want to do with them?  Do you want to replace a small sample of adjacent points with the average point, thereby obtaining a "smoother" representation of the figure?  [That's what I'm guessing you want, based on your title.]


Write down a list of 10 points on a piece of paper.  Do whatever you want to do with them.  Write down the results.  Does it seem to make sense?


Now look at your code.  Are you doing the same thing?  If not, fix it yourself, you'll learn and gain much more satisfaction than if we "do your homework for you".


Bob Schor

0 Kudos
Message 3 of 5

I tried a lot of functions in "Mathematic" and " Signal Processing" in Labview. But it produces the same result, it changed some of my end pointsand it creates a straight line before it ends( graph 2 in image 2), rather it should be a closed line. I need detailed help for this. Thank you for comment.

0 Kudos
Message 4 of 5

The problem is only part "programming" and "LabVIEW" -- the bigger problem (I think) is that you don't seem to understand what it means to "smooth" something.   If I gave you a horizontal line to which I added a small amount of "vertical" noise, and I asked you to "smooth" out the line (say, every 5 points), what would you do?


Much of the time, we deal with time-varying (or "sampled") data, which have the inconvenient behavior that they have a beginning and an end -- we can't use the points "just before I started sample", nor the points "just after I finished sampling".  Your situation, however, is more fortunate -- your data form a cycle, with the "last" point right next to the "first" one (so you know the points "before the beginning" and "after the end", which, if you know how to smooth, means you can smooth the entire closed curve).  So figure out how to "get rid of the noise" on a horizontal line (equivalent to "smoothing" it), adapt it to a "cyclic" (or repetetive) set of data, and you'll solve your problem.


Bob Schor

0 Kudos
Message 5 of 5