Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial data smoothing

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
896
Helped
24
Reputation
48
Reaction score
25
Trophy points
1,318
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,227
I'm working with smart interactive boards. here a smooth line is required to draw anything on the board from a serial set of data (x,y)....

Can anyone suggest me how can I smooth the data. here is a sample set of data recorded serially.


Code:
(179, 56)
(178, 54)
(177, 53)
(176, 51)
(175, 50)
(175, 48)
(173, 47)
(173, 45)
(172, 44)
(171, 42)
(170, 41)
(169, 40)
(169, 39)
(168, 37)
(168, 36)
(168, 36)
(167, 34)
(167, 34)
(167, 32)
(166, 31)
(166, 30)
(165, 29)
(165, 28)
(165, 27)
(164, 26)
(164, 26)
(164, 25)
(164, 24)
(163, 24)
(163, 23)
(163, 22)
(163, 21)
(162, 20)
(162, 19)
(161, 19)
(161, 18)
(159, 17)
(159, 17)
(158, 18)
(158, 19)
(157,163)     << Error one, I need to smooth it 
(157, 22)
(157, 24)
(156, 25)
(156, 26)
(156, 28)
(156, 29)
(155, 30)
(154, 31)
(153, 32)
(152, 34)
(152, 35)
(152, 36)
(151, 36)
(151, 38)
(151, 39)
(150,163)     << Error one, I need to smooth it 
(150, 42)
(150, 43)
(150, 45)
(150, 47)
(151, 49)
(151, 51)
(152, 53)
(152, 54)
(153, 58)
(156, 58)
(156, 59)
(000,000)
(000,000)
(000,000)
(000,000)
(000,000)
(000,000)
(000,000)
(174, 58)
(201, 59)
(199, 61)
(000,000)
(175, 63)
(172, 63)
(170, 58)
(168, 55)
(167, 53)
(165, 50)
(164, 47)
(163, 44)
(162, 41)
(162, 39)
(000,000)
(000,000)
(000,000)
(000,000)
(209, 44)
(000,000)
(000,000)
(000,000)
(187, 63)
(185, 59)
(184, 58)
(182, 57)
(181, 55)
(180, 54)
(179, 53)
(179, 51)
(178, 50)
(178, 49)
(177, 48)
(177, 47)
(177, 46)
(177, 45)
(  7, 44)     << Error one, I need to smooth it 
(176, 43)
(177, 43)
(177, 42)
(178, 42)
(178, 39)
(179, 39)
(179, 39)
(179, 39)
(180, 39)
(180, 38)
(182, 38)
(184, 38)
(185, 39)
(187, 39)
(188, 39)
(190, 39)
(192, 40)
(194, 43)
(196, 43)
(197, 44)
(199, 45)
(200, 46)
(201, 47)
(202, 48)
(203, 49)
(203, 50)
(204, 52)
(205, 53)
(205, 54)
(206, 56)
(206, 57)
(206, 58)
(205, 58)
(205, 59)
(204, 60)
(204, 60)
(200, 61)
(199, 63)
(199, 63)
(198, 63)
(197, 63)
(196, 63)
(195, 63)
(191, 63)
(190, 60)
(189, 60)
(188, 59)
(187, 58)
(186, 58)
(185, 57)
(184, 57)
(183, 56)
(182, 55)
(181, 54)
(180, 54)
(179, 50)
(178, 50)
(178, 49)
(178, 47)
(178, 46)
(177, 45)
(177, 44)
(177, 43)
(177, 42)
(177, 41)
(177, 40)
(177, 39)
(178, 38)
(178, 37)
(178, 36)
(179, 35)
(179, 35)
(181, 34)
(182, 34)
(183, 33)
(184, 33)
(185, 33)
(187, 32)
(188, 32)
(189, 32)
(191, 33)
(193, 33)
(195, 34)
(197, 35)
(199, 35)
(200, 36)
(202, 37)
(204, 37)
(  5, 38)     << Error one, I need to smooth it 
(206, 39)
(208, 40)
(209, 42)
(210, 43)
(210, 44)
(211, 45)
(211, 47)
(211, 48)
(211, 49)
(212, 50)
(212, 50)
(211, 51)
(211, 55)
(210, 56)
(210, 57)
(209, 58)
(000,000)
Here is the data patterns, here to draw a line these x,y positions are used. But as the data are not smooth all the time so I need to add an equation to keep it smooth. Also there are some noise in the data. I just can't eliminate the data because it creates further error or discontinuous line.

Please suggest me what equation I can use to smooth the data.
 

The problem hasn't much to do with data smoothing. Instead you apparently want to eliminate erroneous data, which is known as outlier truncation in statistics.

I just can't eliminate the data because it creates further error or discontinuous line.
Obviously, that's not the case for the given example data. You get the smoothest line by just the deleting the erroneous data points. After eliminating the errors, you may want to generate a smoother line, e.g. by spline interpolation.
 

With EXCEL you can analyse the dispersion of the data, and perhaps there you can somehow create a simple VBA application to detect how certain data is appart from the allowed range. The simplest approach could be just by using the distance from the central region as a metric, but a more complex approach could be by tracking neighbor points of a chronological sequence to substantiate the legitimacy of their values. Surely there must be a simplest method to do this, but that's what came to mind.

Here is your dataset plotted with the spreadsheet, and even not using any elaborated/automated mechanism to do that filtering, at least with this graphical means you can quicly determine by visual inspection the valid points, removing manually all the uncoherent samples ( there are 5 of them ):

Dispersion.png

Note that this way you would not change the data iteself, but just eliminate all the uncorrelated values, removing them instead of replacing by interpoled values.
 

Attachments

  • Graph.png
    Graph.png
    15.1 KB · Views: 61

I added filters to replace the unusual data by avg of previous and past one. And then added exponential smoothing equation.

Now it is much more smooth than before. Also I'm working for further smooth operation.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top