Memuat
Memuat
The following car keeps a safe gap that grows with speed, then returns to the set speed when the road clears.
0 views
The lead car changes speed (accelerates, brakes and speeds up again) while the 1,500 kg following car uses two controllers: FOLLOW mode (a distance PI plus a relative-speed term) and CRUISE mode (a speed PI toward a 30 m/s set speed). A MinMax block picks the most cautious command, limited to +2.5 throttle and -6 m/s2 braking.

A 22 m/s speed plus a surge, braking, throttle and a sine, with acceleration limited to +2 and -4 m/s2.
The gap is the integral of the speed difference; the safe gap equals 5 m plus 1.6 s times the speed.
Acceleration = Kp times gap error + Ki times its integral + Kv times the speed difference.
A speed PI tracks the 30 m/s set speed.
MinMax takes the smaller of the two modes, then a Saturation limits throttle and braking.
Mass times acceleration equals force minus air and rolling resistance, with a 0.3 s drive lag.
System
A 1,500 kg car with air and rolling resistance, a 0.3 s drive lag and an initial gap of 40 m.
Scenario
A 240 s simulation with a 0.01 s step; the lead car surges at 50 s, brakes at 110 s and speeds up at 170 s.
Note: The minimum safe-gap margin is negative: when the lead car brakes the gap briefly dipped 1.4 m below the target safe gap, though no collision occurred. No radar sensor or noise is modelled.
Simulink model acc_mobil_otonom.slx (standard block diagram); Builder script buat_model.m and runner jalankan.m; Result plots grafik_acc (PNG) and metrik.json; Step-by-step PDF guide (sent with the package; also part of the video class); Video tutorial in the MATLAB Simulink 2026 Trends class (this project's episode; episode 1 is free); Requires MATLAB and Simulink (built in R2025b); the slh.m builder helper is included.
Yes. The .slx model opens in MATLAB with Simulink (built in R2025b; use the same or a newer release). Project 09 also needs the Communications Toolbox. The package includes the builder script and the runner, so you can also rebuild the model and rerun the plots yourself.
Yes. Parameters are kept in the Model Workspace, so you can change values such as gains, capacities and profiles and rerun the simulation. If you would like us to adapt or extend the model for you, message us on WhatsApp.
The project costs US$17. Use the "Buy via WhatsApp" button on this page; the project files are delivered after payment is confirmed.
Found a problem or have a suggestion for this project? Tell us on WhatsApp
Back to MATLAB Simulink portfolio