Clear Filters
Clear Filters

Why do I receive Warning: Marker input is ignored?

7 views (last 30 days)
Andy
Andy on 31 Mar 2023
Commented: Andy on 31 Mar 2023
This is the code for simulating a 'pulse-and-glide' car journey:
clc
clearvars
% Aero constants Faero = 0.5*rho*Cd*Af*v^2
Cd = 0.37;
Af = 1.52;
rho = 1.225;
% % Rolling resistance ceofficient (Frr = Normalforce*Crr)
Crr = 0.00294;
% Vehicle/earth constants
mveh = 80;
mload = 40;
m = mveh+mload;
g = 9.81;
% Distance of PNG section, 1 mile in metres
intervallength=1609;
% Velocity thresholds m/s
vlow = 3.1;
vhigh = 5.5;
Tm = 1.5; % Torque generated by the motor
GR = 8; % Gear Ratio
% Think about how you calculate Tw and Ft. Note gear ratio is a
% *reducation* ratio. Motor speed is faster than wheel speed... so what
% happens to the torque?
Tw = GR*Tm; % Torque at the wheels
% Tw is equal to GR*Tm
rw = 0.4; % wheel radius
% Assuming that the rolling radius of the wheel is the same as the radius
% of the wheel, the intuition being the tyre is filled up with
% incompressible fluid
Ft = Tw/rw; % Tractive Force
% At time equals zero, vehicle will accelerate from standstill.
pulseflag = 1; % When vehicle pulsing, pulseflag is 1. When coasting, pulseflag is 0
% Initialise displacement, velocity and acceleration
x(1) = 0;
v(1) = 1e-10;
a(1) = 0;
% Timestep
dt = 0.1;
% Define values that are constant
normalforce = m*g; % Normalforce
Frr = Crr*normalforce; % Rolling resistance
% Iniitalise counter
k = 1;
while x(k)<=intervallength % while loop
% Define values that change every iteration
Faero(k) = 0.5*rho*Cd*Af*v(k)^2;
Fd(k) = Faero(k) + Frr;
% Are we pulsing, and what's the acceleration in the next loop?
if pulseflag == 1
a(k+1) = (Ft-(Faero(k)+Frr))/m;
else
a(k+1) = (-(Faero(k)+Frr))/m;
end
% What's the velocity in the next loop?
v(k+1) = v(k)+a(k+1)*dt;
% Setting pulseflag for next iteration
if v(k+1) >= vhigh
pulseflag = 0;
elseif v(k+1) <= vlow
pulseflag = 1;
end
% Logging pulseflag value per iteration
flag(k) = pulseflag;
% What the displacement
x(k+1) = x(k)+(v(k+1)/a(k+1));
k = k+1;
end
timeon = sum(flag(:))*dt; % Number of iterations when pulseflag = 1 times timestep
totaltime = k*dt; % Number of iterations times timestep, the finish time.
% Plot of velocity versus displacement
subplot(2,1,1)
plot(x,v)
hold on
yline(vhigh,'--','vHigh')
yline(vlow,'.','vLow')
hold off
grid on
title('Velocity Vs Displacement')
xlabel('Displacement')
ylabel('Velocity')
ylim([0, 7])
% Plot of velocity versus time
timemaster = linspace(0,k*dt,length(v));
subplot(2,1,2)
plot(timemaster,v)
hold on
yline(vhigh,'--','vHigh')
yline(vlow,'.','vLow')
hold off
grid on
title('Velocity Vs Time')
xlabel('Time')
ylabel('Velocity')
ylim([0, 7])
Why do I receive the error message Warning: Marker input is ignored?

Answers (1)

Walter Roberson
Walter Roberson on 31 Mar 2023
Edited: Walter Roberson on 31 Mar 2023
  3 Comments
Walter Roberson
Walter Roberson on 31 Mar 2023
yline(vhigh,'--','vHigh')
That line is fine, because '--' is a valid line style.
yline(vlow,'.','vLow')
That line has a problem, because '.' is a marker style rather than a line style. Consider using '-.' line style, or using different colors for the different lines.

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!