Created
November 29, 2017 19:33
-
-
Save davidbradway/bae7b4da1c32618a8cef5cb8f4ae6e81 to your computer and use it in GitHub Desktop.
Cost Analysis of Bike Shares in Durham (MATLAB)
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
%% Cost Analysis of Bike Shares in Durham | |
rpm = 1:105; % rides per month | |
L1 = rpm; | |
L2 = 14 * ceil(rpm/100); | |
S1 = 5 * ceil(rpm/6); | |
S2 = 29 + 0*rpm; | |
figure(1), clf | |
subplot(2,1,1) | |
plot(rpm(1:31), L1(1:31), '-r', rpm(1:31), S1(1:31), '-b') | |
hold on, plot(rpm, L2, '-.r', rpm, S2, '-.b') | |
xlabel('Rides per month') | |
ylabel('$') | |
title('Total Spent') | |
subplot(2,1,2) | |
plot(rpm, L1./rpm, '-r', rpm, L2./rpm, '-.r', ... | |
rpm, S1./rpm, '-b', rpm, S2./rpm, '-.b') | |
legend('LimeBikes $1 per ride', 'LimeBikes 100 rides for $14', ... | |
'Spin 6 rides for $5', 'Spin unlimited $29/mo') | |
xlabel('Rides per month') | |
ylabel('$ per ride') | |
title('Price per Ride') | |
axis([0 120 0 2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment