How do we interpolate a data set with noise?
조회 수: 63 (최근 30일)
이전 댓글 표시
Hello folks,
I am given an 1-D data set representing the daily prices of gold.
I have looked at the 1-D data interpolation that is nicely written by MathWorks: https://www.mathworks.com/help/matlab/ref/interp1.html
Because gold is traded intraday, an hourly data set would better capture this noise than a daily data set, and a 30-minute data would better capture it than the hourly data set ,and so on.
My objective is to interporlate the daily price data with some noise such as a Brownian noise.
Ultimately, I would like to collect these noise-incorporated points as a reasonably good interporlated data and run some other experiments on it.
Any comments or suggestions would be appreciated.
Thanks!
댓글 수: 0
채택된 답변
John D'Errico
2022년 7월 30일
Um, you generally don't want to interpolate noisy data! That is just a good way to amplify the noise. I did show many years ago, that the best way to interpolate noisy data is probably simple linear interpolation, thus connect the dots. Even better in that respect is just nearest neighbor interpolation. Typically higher order methods, such as a spline interpolation can produce a solution that is higher variance at any intermediate point. So you don't want to interpolate noise.
Perhaps better is to first smooth your data. Now you can use tools to interpolate the smoothed response. There are of course many tools you can use to smooth data.
t = 1:100;
Y = sin(t/10) + randn(size(t))/3;
plot(t,Y,'o')
Now, if we interpolate the noisy data, we get noisy crap.
tint = linspace(min(t),max(t),1000);
Yint = interp1(t,Y,tint,'spline');
plot(t,Y,'ro',tint,Yint,'r-')
plot(t,smooth(Y),'o')
Clearly an interpolation will fare better based on the smoothed result, though when the noise to signal ratio is high enough, we can still get crap.
댓글 수: 3
John D'Errico
2022년 7월 30일
편집: John D'Errico
2022년 7월 31일
Huh? Why in the name of god and little green apples would you do that?
So just use interpolation. A spline will be fine then. And THEN add noise to it. What is the problem? Ok, I still have no clue why you would do that. Yes, I suppose you are probably generating noisy data for an example problem of some sort. But doing it is trivial.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!