Interpolating Missing Data with Noise like Brownian Motion

5 views (last 30 days)
Hello folks,
I have a few questions regarding interpolating financial price data set.
I have a set of price points, but their frequency is not high, so I would like to interporlate between these between.
For instance, consider 24 by 2 double price data points where it spans over 24 hours.
Between each hour, I would like to interporlate 15, 30, 45, so total three interporlated points, that way I now have 72 points per day.
However, I would like to insert some noise that follows possibly a geometric brownian motion or random walk to give a flavor of randomness in the data and they are not all linear connected.
What might be the best way to do this?
I have the basic codes so far of importing the data and converting to 24 by 2 double format:
file= "pricedata.xlsx";
Tab =readtable(file);
Any suggestions?
Thanks in advance!

Accepted Answer

Bruno Luong
Bruno Luong on 2 Sep 2022
"What might be the best way to do this?'"
Interpolation THEN
adding noise.
There is no reason to mix the noise generation with interpolation step.
Tatte Berklee
Tatte Berklee on 8 Sep 2022
Excellent. No, you are correct. I wanted this, but your sample code had 3600, so now it is clear to me you put 3600 for demonstration. Thanks!

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 2 Sep 2022
Try this:
rows = 24;
prices = round(100*rand(rows, 2), 2) % [Beginning of day, end of day]
% Scan down getting prices.
% Allocate 72 points per day, including the start and end.
interpPrices = zeros(rows, 72);
for row = 1 : rows
% Add up to +/- 2 unit of noise.
noise = 2 * rand(1, 72);
interpPrices(row, :) = round(linspace(prices(row, 1), prices(row, 2), 72) + noise, 2);
Tatte Berklee
Tatte Berklee on 6 Sep 2022
Thanks for the response and comments. I will try this method as well!

Sign in to comment.


Find more on Interpolation in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!