motorSpeed(1,20);
goFor(1);
reverse(1);
motorSpeed(1,20);
motorSpeed(2,20);
goFor(2);
RUNS (Changing Motor Speed Each Trial)
reverse(1);
motorSpeed(4,20);
goFor(3);
brake(4);
goFor(3);
reverse(4);
motorSpeed(4,20);
goFor(3);
brake(4);
goFor(3);
AR&D Data and MATLAB code
DATA:
MATLAB code:
clc
%this is an array of the time cost at each interval
costTime=(Times(1:end)*1500)+90000;
%this is an array of the energy cost at each interval
costEnergy=(TotalEnergyJ(1:end)*500)+125000;
%this is an array of the total cost at each interval
costTotal=costTime(1:end)+costEnergy(1:end);
figure(1)
plot(Distancem,costTime)
title(‘Time Cost vs Distance’)
xlabel(‘Distance (m)’)
ylabel(‘Amount ($)’)
grid on
figure(2)
plot(Distancem,costEnergy)
title(‘Energy Cost vs Distance’)
xlabel(‘Distance (m)’)
ylabel(‘Amount ($)’)
grid on
figure(3)
plot(Distancem,costTotal)
title(‘Total Cost vs Distance’)
xlabel(‘Distance (m)’)
ylabel(‘Amount ($)’)
grid on
figure(4)
plot(Distancem,Times)
title(‘Time vs Distance’)
xlabel(‘Distance (m)’)
ylabel(‘Time (s)’)
grid on
figure(5)
plot(Distancem,TotalEnergyJ)
title(‘Total Energy vs Distance’)
xlabel(‘Distance (m)’)
ylabel(‘Energy (J)’)
grid on
fprintf(‘\nTotal time cost = $%.2f’,costTime(end))
fprintf(‘\nTotal energy cost = $%.2f’,costEnergy(end))
fprintf(‘\nTotal cost = $%.2f’,costTotal(end))