From MATLAB Hackathon to Real-World Motorcycle Modeling

As chemical engineering students interested in real-world practical problems we are always on the lookout for challenges or competitions organized by companies that focus on a specific task. That’s why when we found the 2026 DATA-ENG Hackathon competition we gladly accepted the challenge. The Hackathon was organized by SciEngineer, AUMOVIO, and the University of Pannonia and combined data analysis, modeling, and teamwork, providing us with valuable hands-on experience in an industrial context.

  • 43

All four of us study in the University of Pannonia. Éva Kenyeres is a PhD student specializing in modelling, stochastic algorithms, programming and optimisation. Csenge Juhász has a BSc in Chemistry but her research is centred around data science. Levente Sólyom and Ferenc Gulyás are both chemical engineers with interest in process modelling. All of us knew MATLAB beforehand so this competition seemed like a good opportunity to test our skills on a real life problem.

Challenge

Our task was to estimate the difference in circumferential speed between the front and rear wheels of a motorcycle in order to implement better cruise control methods in future vehicles. We were provided with two sets of experimental data made with two different motorcycles. Each of them underwent several measurements where they were ridden with different speeds and leaning angles. From this information our task was to come up with a model that predicted speed difference of the wheels from the speed of the motorcycle and the leaning angle.

Although we were familiar with MATLAB and Simulink we did the recommended MathWorks courses. They provided insight into the useful toolboxes that we used during the solution. Thanks to the quality of the courses and our previous experiences we easily managed them and gained lots of new skills.

The next challenge was solving the real problem. In the first phase of the competition we were only allowed to use a priori models. To solve this we began reading the literature where we found that this area of research is a quite relevant nowadays. We also had to figure out ways to filter the dataset which contained quite bit of noise. In the second phase we were allowed to use whatever modelling method we liked, including neural networks, than we had to present our work in front of a jury made up of SciEngineer & Aumovio professionals.

Solution

Since the raw measurement data contained significant sensor noise, effective signal processing was an essential first step before any modelling activities could begin. To reduce measurement noise, different filtering techniques were applied depending on the characteristics of the recorded signals. Motorcycle speed and lean angle were processed using an Infinite Impulse Response (IIR) filter, which provides efficient smoothing while maintaining computational simplicity. The filter parameters were selected based on the sampling frequency and an experimentally determined cut-off frequency to preserve the relevant dynamic behaviour while eliminating high-frequency disturbances. Wheel speed signals were processed separately using a second-order Butterworth low-pass filter, which effectively suppresses rapid fluctuations without significantly affecting slower, physically meaningful variations in the measurements.

After filtering, the team identified quasi-stationary operating points to improve the reliability of parameter estimation. This was achieved by calculating the time derivatives of the filtered vehicle speed and lean angle. Measurement points exceeding predefined threshold values were classified as dynamic and excluded from the model fitting process. By restricting the optimisation to stable operating conditions, the influence of transient effects and measurement uncertainty was significantly reduced, leading to a more reliable representation of the underlying physical system.

The mathematical model was designed to estimate the circumferential speed difference (Δv) between the front and rear wheels based on vehicle speed (v) and lean angle (φ) while incorporating the primary forces acting on the motorcycle. The formulation considers rolling resistance (cr), aerodynamic drag (CD), tyre longitudinal stiffness (Cκ), and the geometric effects introduced by motorcycle lean. Together, these components provide a physically interpretable relationship between operating conditions and the expected wheel speed difference rather than relying solely on empirical curve fitting (1).

Δv = v · [(cr·m·g + ½·ρ·CD·A·v²) / Cκ] · 1/√(1 − tan²φ) (1)

Where m denotes the combined mass of the motorcycle and rider; g is the gravitational acceleration; ρ is the air density; and A is the effective frontal area.

Several model parameters, including the rolling resistance coefficient, drag coefficient, effective frontal area, and longitudinal stiffness coefficient, were not directly available and therefore required optimisation. Parameter estimation was carried out using MATLAB’s constrained nonlinear optimisation algorithm, which minimised the mean absolute prediction error across the filtered quasi-stationary dataset. Appropriate parameter bounds were defined to ensure physically realistic solutions, and variable scaling was applied to improve numerical stability during optimisation. The optimisation converged successfully without any parameter reaching its imposed limits, indicating that the identified solution represented a genuine optimum within the feasible search space.

This was our final solution for the first phase however we had the opportunity to refine our model in the second phase. The other teams opted to use neural networks to this task; we, however decided to use data driven methods to refine our solution. Instead of relying solely on the original physical equation, we generated a large set of additional predictor variables, including polynomial, exponential, and interaction terms derived from vehicle speed and leaning angle. A stepwise regression algorithm was then used to automatically select the most relevant predictors while eliminating redundant variables. Model selection was guided by the Akaike Information Criterion (AIC), which balances model accuracy against complexity to reduce the risk of overfitting. The resulting regression model was subsequently validated on multiple motorcycle datasets. The evaluation metrics, including RMSE, MAE, and the coefficient of determination (R²), demonstrated consistently high predictive accuracy on both the training and test sets. These results indicate that the refined black-box model achieved better generalization while preserving the physical insights obtained from the original white-box model.

Result

The resulting model was evaluated using datasets from two different motorcycles. Performance varied between the vehicles, demonstrating both the strengths and limitations of the modelling approach. For the Moto Guzzi dataset, the model achieved the desired prediction accuracy, with the majority of estimated wheel speed differences remaining within the target error threshold. Time-series comparisons further confirmed that the predicted values closely followed the measured data throughout the test sequences.

The Triumph dataset presented a more challenging scenario. Although the model produced satisfactory predictions during most operating conditions, a noticeable increase in prediction error occurred during the initial portion of the measurements. This behaviour suggests the presence of physical phenomena or operating conditions that were not captured by the simplified mathematical formulation. However, after employing the data driven techniques in the second phase of the competition we were able to achieve much better agreement with the experimental results. Figures 1 and 2 show the predictions of the models developed in the second phase.

 

Figure 1: Fitting of quasi-static points for the Triumph vehicle

 

Figure 2: Fitting of quasi-static points for the Guzzi vehicle

 

Finally, the MATLAB implementation was translated into C and evaluated against the hardware requirements specified by the competition. Testing confirmed that the algorithm satisfied all memory and runtime constraints while requiring no EEPROM usage. The implementation consumed less RAM and ROM than the specified limits and completed its computations well within the maximum execution time. These results demonstrate that the developed solution is not only computationally efficient but also suitable for deployment on embedded automotive hardware, making it a practical candidate for real-time motorcycle control applications.

Summary

In summary we had to make a model that predicted the speed difference between the front and rear wheels. After filtering the data and selecting an appropriate physics based model, we optimized the parameters and compiled our code into C. This experience helped broaden our vision about what can be done with MATLAB software and gave us insight into the industry.

Featured products

All products mentioned are developed by MathWorks®:

Recommended Events

Recommended Posts

Excitation Signals for Identification of Dynamic Systems

Excitation Signals for Identification of Dynamic Systems

Learn about optimizing multisine signals for precise frequency-domain system identification. Discover the importance of low Crest Factor (CF) in excitation signals and explore techniques to enhance signal-to-noise ratios (SNR) for improved measurement accuracy.

MATLAB and Simulink for Automotive

MATLAB and Simulink for Automotive

Discover how MATLAB and Simulink drive automotive innovation. Learn how these tools expedite vehicle development and help OEMs meet evolving market demands.

Ai robotics working on a car

AI: Driving the Industry Towards Greater Success

Artificial intelligence (AI) is seen as a promising technology that can help leading OEMs to maintain their position as market leaders. In this post, read about how AI is changing the manufacturing sector, as well as its potential advantages and potential drawbacks.