-
-
Save RenolY2/ee4689432f6b22c813be01bcd549aae5 to your computer and use it in GitHub Desktop.
calcs creates the decaying rally values till the rally falls below 0.005 (i.e. too small to be significant)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vals = calcs(5); | |
hours = size(vals, 1); | |
x_vals = [1:hours] | |
plot(x_vals, vals) | |
xlabel('hours') | |
ylabel('rally') | |
title('Rally over time') | |
function vals = calcs(start) | |
vec = eye(1,1); | |
vec(1,1) = start; | |
i = 0; | |
while (start > 0.005) | |
i = i + 1; | |
if (start > 1) | |
start = start - start*0.04; | |
else | |
start = start - start*0.02; | |
end | |
vec(i,1) = start; | |
end | |
vals = vec; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment