How do we interpolate a data set with noise?

64 visualizaciones (últimos 30 días)
Tatte Berklee
Tatte Berklee el 30 de Jul. de 2022
Comentada: Tatte Berklee el 31 de Jul. de 2022
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!

Respuesta aceptada

John D'Errico
John D'Errico el 30 de Jul. de 2022
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 comentarios
John D'Errico
John D'Errico el 30 de Jul. de 2022
Editada: John D'Errico el 31 de Jul. de 2022
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.
Tatte Berklee
Tatte Berklee el 31 de Jul. de 2022
Hi John, thanks for the reply. When you say "doing it is trivial", can you explain a bit more?
What I am thinking of fitting a spline and obtain both the original and interpolated points.
After that, how do I add noise to these data points?
Specifically, I do not want to perturb the original data points but just add noise in between the spline-interpolated points.
As to why I want to do that, it is to generate a reasonable approximation of how the data would have behaved if it followed something like a geometric Brownian motion.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by