Assignment vehicle model longitudal

Hello. When executing this script I get an error. I have no clue what I did wrong. It has to do something with "tout". The script should work together with the simulink document. In the attachment I have uploaded the assignment.
%
%
%
close all; clear; clc; format short; format compact;
%
% Parameters
T = 110; % Torque [Nm] 110 @4000 [rpm]
rpm = 4000; % rpm in
f0 = 123.6; % static roll resistance [N]
f1 = 1.007; % dynamic roll resistance [N/(km/h)]
f2 = 0.02978; % Air resistance [N/(km/h)^2];
A = 2.01; % Vehicle Frontal Area [m²]
Cd = 0.32; % Drag coefficient [-]
Rho = 1.25; % Air density [kg/m^3]
m = 1145; % Mass [kg]
r = 0.298; % Wheel Radius [m]
Crr = -0.011; % Static Rolling Resistance (Crr) [-]
AirDensity = 1.22; % Air density [kg/m³]
G = 9.81; % Gravitational Acceleration [m/s²]
SimTime = 6; % [s] simulatietijd
% simulatie model
sim("Assignment_Vehicle_simulink_model_2712")
%%Plotten
figure;
plot(out.tout, Snelheid); grid on;
xlabel('Torque [Nm]'); ylabel('snelheid [m/s]');
title ('Voertuigsnelheid');

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2026년 1월 9일

0 개 추천

"tout" is the time ouput variable created after a successful simulation.
In your model, press Ctrl+E, make sure these two options are checked.

댓글 수: 2

JOb
JOb 2026년 1월 11일
Thanks! Although I am getting the next error. Which says the following:
Error using Assignment_Vehicle_Model_2712 (line 24)
Derivative of state '1' in block 'Assignment_Vehicle_simulink_model_2712/Integrator' at
time 0.4 is not finite. The simulation will be stopped. There may be a singularity in the
solution. If not, try reducing the step size (either by reducing the fixed step size or
by tightening the error tolerances)
This is all Greek to me.
Fangjun Jiang
Fangjun Jiang 2026년 1월 12일
Yes. The simulation is not stable. You may try reducing the simulation step size but may require more understanding of the model and Simulink to make it work.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

JOb
2026년 1월 9일

댓글:

2026년 1월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by