# Untitled

unknown
plain_text
6 months ago
1.5 kB
1
Indexable
Never
```% Define constants
f_R = ...; g = ...; m = ...; rho_L = ...; A_c = ...; C_w = ...;
eta_drive = ...; eta_EM = ...; r_dyn = ...; i = ...;
battery_capacity = ...; battery_cell_voltage = ...; battery_cell_resistance = ...;

% Define time, velocity, and acceleration, electric motor and ICE revs and torques as vectors
time = ...; velocity = ...; acceleration = ...;
EM_torque = ...; EM_revs = ...; ICE_torque = ...; ICE_revs = ...;

% Create empty vectors for total moving force and total driving torque
total_moving_force = zeros(size(time));
total_driving_torque = zeros(size(time));

% Loop through each time step
for t = 1:length(time)
if velocity(t) <= 50
% Calculate total moving force and total driving torque for electric motor only
...
elseif velocity(t) > 50 && velocity(t) <= 75
% Calculate total moving force and total driving torque for ICE-Gen only
...
else
% Calculate total moving force and total driving torque for ICE at full load
...
end
end

% Plot results
figure;
subplot(3,1,1);
plot(time, velocity);
title('Time-Velocity');
xlabel('Time (s)'); ylabel('Velocity (km/h)');

subplot(3,1,2);
plot(time, total_moving_force);
title('Time-Total Moving Force');
xlabel('Time (s)'); ylabel('Force (N)');

subplot(3,1,3);
plot(time, total_driving_torque);
title('Time-Total Driving Torque');
xlabel('Time (s)'); ylabel('Torque (Nm)');
```