Code

%500 per Joule + 125,000 Energy Cost
%1500 per second + 90,000 Time Cost
%39.37 meters per inch
distance = Distancem*39.37;
costOfEnergy = sum(TotalEnergyJ*500)+125000;
costOfTime = sum(Times*1500)+90000;
figure(1);
plot(distance, TotalEnergyJ)
hold;
plot(distance,Times)
legend(“Energy(J)”,”Time(s)”,’Location’,’northwest’)
xlabel(“Distance(m)”)
ylabel(“Amount”)
title(“Growths of Energy and Time over a given Distance”)
hold off;
fprintf(“EnergyCost=%.3f”,costOfEnergy)
fprintf(“\nTimeCost=%.3f”,costOfTime)
costOfEnergy = (TotalEnergyJ*500)+125000;
costOfTime = (Times*1500)+90000;InputPowerW;
figure(2);
plot(distance, costOfEnergy)
hold;
plot(distance,costOfTime)
legend(“Energy(J)”,”Time(s)”,’Location’,’northwest’)
hold off;

 

Average Energy costs for the first design are as follows for each percent 92.352 for 40,
177.107 for 30, 1032.904 for 20
Average Time costs for the first design are as follows for each percent 70.158 for 40,
180.289 for 30, 1802.543 for 20
Average Energy costs for the T design are as follows for each percent 83.191 for 40,
92.835 for 30, 243.364 for 20
Average Time costs for the T design are as follows for each percent 110.511 for 40,
116.454 for 30, 562.745 for 20
Average costs for the T design are as follows for each percent 505.193 for Energy
and 280.476 for Time
All units are in dollars per inch

 

Code used, shows collected data cost totals divided by each trials traveled distance.

CostPerDistanceAverages-2lro4v9

celerate(4,0,28,1.5);
goToAbsolutePosition(260);
reverse(4);
motorSpeed(4,35);
goFor(1.2);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,25,1.5);
goToAbsolutePosition(528);
reverse(4);
motorSpeed(4,35);
goFor(1.2);
brake(4);
goFor(5);
celerate(4,0,35,2);
goToAbsolutePosition(380);
reverse(4);
motorSpeed(4,35);
goFor(1.2);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,23,1.5);
goToAbsolutePosition(150);
reverse(4);
motorSpeed(4,35)
goFor(1.2)
brake(4);