Skip to content

Instantly share code, notes, and snippets.

@RenolY2
Last active February 17, 2017 21:09
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/9adb142fc923979e896701dc47f08082 to your computer and use it in GitHub Desktop.
Save RenolY2/9adb142fc923979e896701dc47f08082 to your computer and use it in GitHub Desktop.
MAX = 10
SCALE = 50
x_vals = [1*SCALE:MAX*SCALE]/SCALE;
y_vals = arrayfun(@(x) calcs(x), x_vals);
efficiency_vals = arrayfun(@(x, y) (y/(100*(x-1)/0.09)), x_vals, y_vals);
ax1 = subplot(2,1,1); % top subplot
ax2 = subplot(2,1,2); % bottom subplot
plot(ax1, x_vals, y_vals, '-');
plot(ax2, x_vals, efficiency_vals, '--');
xlabel(ax1, 'Rally Level')
ylabel(ax1, 'Total Gains')
title(ax1, 'Total Gains from Rally when receiving 1 EX at a time')
title(ax2, 'Return on Investment relative to EX spent on building up rally')
xlabel(ax2, 'Rally Level')
ylabel(ax2, 'RoI in % of EX spent')
function y = calcs(start)
current = start;
gain = 0;
fac = 1;
while (current > 1)
gain = gain + fac.*current;
current = current - fac.*0.005;
end
y = gain;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment