Sawtooth diagram for automotive use

Risposte (1)

Here's some code to create a sawtooth pattern:
samples = 100; % per cycle
cycles = 5;
peak = 15;
y = linspace(peak,0,samples);
y = repmat(y,1,cycles);
plot(y);

3 Commenti

I now have this, but it isn't right yet
v_max = 326.8548/3.6; %maximum vehicle speed [m/s]
r_dyn = 0.363; %dynamic rolling radius [m]
i_final = 3.204; %gear ratio final [-]
n_Pmax = 6000/60; %engine speed at maximum power [rps]
i1 = 4.714;
i2 = 3.143;
i3 = 2.106;
i4 = 1.667;
i5 = 1.285;
i6 = 1;
i7 = 0.839;
i8 = 0.667;
speed = 0:1:v_max;
n_motor_i = 0:1:v_max;
for i = 1:v_max
n_motor_i(i) = speed(i)/r_dyn*i1*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i2*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i3*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i4*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i5*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i6*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i7*i_final;
if n_motor_i(i)>n_Pmax
n_motor_i(i) = speed(i)/r_dyn*i8*i_final;
end
end
end
end
end
end
end
end
figure(1)
plot(speed,n_motor_i)
This if-tree is a bit dizzying. Plus, it can't be right since all the if-conditions are identical and occur in each iteration of the for-loop: n_motor_i(i)>n_Pmax. You need to re-think the logic. Good luck.
Hello Scott,
I now came to this script:
close all, clear all, clc
v_max = 384.159/3.6; %maximum vehicle speed (calculated) [m/s]
r_dyn = 0.363; %dynamic rolling radius [m]
i_final = 3.204; %gear ratio final [-]
n_Pmax = 6000; %engine speed at maximum power [rpm]
w_Pmax = 2*pi*6000/60; %engine speed at maximum power [rad/s]
i1 = 4.714;
i2 = 3.143;
i3 = 2.106;
i4 = 1.667;
i5 = 1.285;
i6 = 1;
i7 = 0.839;
i8 = 0.667;
speed = 0:1:v_max;
w_motor_i = 0:1:v_max;
for g = 1:v_max
w_motor_i(g) = speed(g)/r_dyn*i1*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i2*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i3*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i4*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i5*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i6*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i7*i_final;
if w_motor_i(g) > w_Pmax
w_motor_i(g) = speed(g)/r_dyn*i8*i_final;
end
end
end
end
end
end
end
end
figure(1)
plot(speed,w_motor_i)
title('Sawtooth diagram')
yline(2*pi*6000/60,'k','Pmax');
xlabel('Vehicle speed [m/s]')
ylabel('Engine speed [rad/s]')
xlim([0, v8])
This also looks like how I drew it, except for that this graph doesn't reach the maximum engines speed power line.
And by the way, thank you for your help and responses!

Accedi per commentare.

Categorie

Prodotti

Release

R2020a

Richiesto:

il 18 Mag 2021

Commentato:

il 19 Mag 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by