I have a 3D sensor which measures v(x,y,z) data. I\'m only using the x and y data. Smoothing only x and y would be enough.
If I use a log to show the data, it shows
Digging up an old question here, but if you're in .NET land, you can use the RX to do this for you.
For example, using RX in conjunction with WebClient.DownloadFileAsync to calculate a "smoothed" download speed:
double interval = 2.0; // 2 seconds
long bytesReceivedSplit = 0;
WebClient wc = new WebClient();
var downloadProgress = Observable.FromEventPattern<
DownloadProgressChangedEventHandler, DownloadProgressChangedEventArgs>(
h => wc.DownloadProgressChanged += h,
h => wc.DownloadProgressChanged -= h)
.Select(x => x.EventArgs);
downloadProgress.Sample(TimeSpan.FromSeconds(interval)).Subscribe(x =>
{
Console.WriteLine((x.BytesReceived - bytesReceivedSplit) / interval);
bytesReceivedSplit = x.BytesReceived;
});
Uri source = new Uri("http://someaddress.com/somefile.zip");
wc.DownloadFileAsync(source, @"C:\temp\somefile.zip");
Obviously the longer the interval, the greater the smoothing will be, but also the longer you will have to wait for an initial reading.