Calculating ∆t from data set and plotting

8 Ansichten (letzte 30 Tage)
jacob Mitch
jacob Mitch am 15 Okt. 2019
Beantwortet: Anudeep Kumar am 23 Apr. 2025 um 8:40
If I have financial data with prices as the first column and I create an array of integers from 1 to the length of data to use as a time axis am I correct in calculating deltaT
Thetotalnumberdays=10 %size of the first column
arraynumbers=1:Thetotalnumberdays %use as time axis
deltat=diff(arraynumbers) %possible deltat?
Which gives me a new array of singles. How would I then proceed to calculate specific values of ∆t such as ∆t=1 and is it possible to relate this to prices in that. I wish to plot d1(t) in that.
dt(t)=x(t+t)+x(t)
for x prices

Antworten (1)

Anudeep Kumar
Anudeep Kumar am 23 Apr. 2025 um 8:40
Hey Jacob,
If I am understanding the question correctly, assuming you have a variable ‘prices’ and you want to calculate the change in it at ever ∆t and plot it.
Assuming column vector ‘prices’ and Time vector ‘time’ and using your formula
dt(t)=x(t+t)+x(t)
prices = rand(10,1)*100; % Example data
N = length(prices);
time = (1:N)';
DeltaT = 1;
dDeltaT = prices(1+DeltaT:end) + prices(1:end-DeltaT); %your formula
plot(time(1+DeltaT:end), dDeltaT, 'o-');
xlabel('Time');
ylabel(['d_{\Delta t}(t), \Delta t = ' num2str(DeltaT)]);
title('Price Difference');
Feel free to update the variables as per your data.
Hope this helps!

Kategorien

Mehr zu Financial 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!

Translated by