Skip to content

Instantly share code, notes, and snippets.

@RenolY2

RenolY2/plot.m Secret

Created February 14, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RenolY2/ee4689432f6b22c813be01bcd549aae5 to your computer and use it in GitHub Desktop.
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)
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