Data Frequency Transformation
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
I use a dataset of intraday stock prices at random time intervalas.
Is there any code to transform these data into specific freequency ones with respect to time (i.e. 5-min prices, 60-min prices etc)
Thanks in advance,
Panos
0 Kommentare
Akzeptierte Antwort
Dr. Seis
am 15 Dez. 2011
Try interpolation!
doc interp1
Here is an example using "interp1" with the method set to "spline":
T = 60*8; % max time = 480 minutes (= 8 hours)
t = 0:5:T; % uniform time across T every 5 minutes
t_rand = sort(rand(1,T)*T); % irregular time across T at random sample intervals
data = @(t)sin(2*pi*0.03*t) + cos(2*pi*0.1*t) + sin(2*pi*0.05*t) + 2*sin(2*pi*0.005*t) ;
data_interp = interp1(t_rand,data(t_rand),t,'spline');
plot(t,data(t),t_rand,data(t_rand),t,data_interp);
legend('Uniform time','Random time', 'Interp time');
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!