cumulative maximum loss code
Ältere Kommentare anzeigen
I'm new to Matlab and I'm having trouble with the code for the computation of cumulative maximum loss for a time series. What I need to do is to compute the maximum loss compared to the highest levels of the variable over a period T which is set to 522 days.
Specifically,
Thank you for any help
Antworten (1)
Koushik Vemula
am 9 Mär. 2020
According to my understanding you have a variable ‘x’ which has ‘n’(say) number of values.
You would like to find the value of
where the value 522 is ‘T’ value.
You can do it in the following manner
1-(x(t))/max(x(1:T+1))
We have ‘+1’ as matlab index starts from ‘1’
6 Kommentare
Alex
am 11 Mär. 2020
Koushik Vemula
am 11 Mär. 2020
so you want to compare the observations from x(t) to x(t-T) for all the values of t > T
Alex
am 11 Mär. 2020
Koushik Vemula
am 11 Mär. 2020
you can do that in this manner (let us take 560 for example)
1-(x(560)/max(x(560-522:560)))
This will check the values from x38 to x560 and takes the max value of it as the denominator
Alex
am 13 Mär. 2020
Koushik Vemula
am 16 Mär. 2020
for i = T+1:length(x)
sol(i)=1-(x(i)/max(x(i-T:i)))
end
Here we are iterating from T+1 (index should be greater than 0) to max of x.
This will give you your desired result
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!