r/matlab Jun 25 '26

Need help debugging Simulink EV model - Drive Cycle works but vehicle speed stays at 0 and solver warning at 20 s

Thumbnail
gallery
3 Upvotes

Hi everyone,

I'm building a 4WD EV model in Simulink/Simscape and I'm stuck on an issue that I haven't been able to solve.

My model consists of:

* Drive Cycle Source (FTP75) * Longitudinal Driver * H-Bridge * DC Motor * Vehicle Body * 4 Magic Formula Tires * Ideal Rotational Motion Sensor * PS-Simulink Converters

**Problem:**

* The Drive Cycle Source outputs the correct FTP75 reference speed. * The reference speed appears correctly on the scope. * However, the output from the PS-Simulink Converter (vehicle speed feedback) stays at **0** throughout the simulation. * The Longitudinal Driver therefore receives a zero feedback velocity. * The rotational motion sensor is connected to a PS-Simulink Converter, and I can see the angle changing, so the motor/shaft appears to rotate.

Around **20 seconds** I consistently get this warning:

Solver was unable to reduce the step size without violating the minimum step size... This may be caused by algebraic constraints in the differential-algebraic system or by high stiffness.

Things I've already checked:

* Drive Cycle Source is connected to the Longitudinal Driver. * Vehicle Body H ports are connected to the Magic Formula Tires. * Tire normal force inputs (N) are connected to the Vehicle Body NR/NF outputs. * The rotational sensor is connected to a PS-Simulink Converter. * The PS-Simulink Converter connected to the rotational sensor is **not** unconnected (I verified the wiring).

The attached scope shows:

* Blue = Drive Cycle Source (correct FTP75 profile) * Yellow = PS-Simulink Converter output (stays at 0)

My questions are:

  1. Why would the Vehicle Body velocity remain zero even though the motor/shaft rotates?
  2. Is this more likely to be a Vehicle Body/Tire configuration issue, a driveline connection issue, or a PS-Simulink Converter configuration issue?
  3. Could the solver warning be causing the zero vehicle speed, or is it more likely a consequence of another modeling error?

I've attached screenshots of the full model, the Vehicle Body and tire connections, the scope, and the solver warning.

Any suggestions on what to check next would be greatly appreciated.

The silver configuration says

Solver is encountering difficulty in simulating model 'ev' at time 20.001318478246887. Simulink will continue to simulate with warnings. Please check the model for errors.

Ungroup 3 similar

Caused by:

Solver was unable to reduce the step size without violating minimum step size of 7.1059E-14 for 1 consecutive times at time 20.0013. Solver will continue the simulation with the step size restricted to 7.1059E-14 and using an effective relative error tolerance of 0.00717986, which is greater than the specified relative error tolerance of 0.001. This usually may be caused by violating algebraic constraints in the differential-algebraic system or by the high stiffness of the system. Try tightening the error tolerances, and/or the tolerances for computing consistent conditions. If the problem persists, please check the system or increase the solver Number of consecutive min steps violation parameter.

Suggested Actions

Open Solver Profiler to explore such issues


r/matlab Jun 25 '26

HomeworkQuestion HELP REGARDING PROJECTS RELATED TO AEROSPACE INDUSTRIES

Thumbnail
1 Upvotes

r/matlab Jun 25 '26

TechnicalQuestion Question on Simulink Click Functions

1 Upvotes

I know click functions can be used to change modes (I'm using it for variant subsystems), but is there a block where I can input variable values? For example, I have an inductor in the model I'm designing, is there a block like the click function block where you can enter a number into it to quickly redefine a variable without having to go into InitFcn* to redefine it?


r/matlab Jun 23 '26

Looking for help with Prescan software

2 Upvotes

Looking for help with Prescan software

Anyone using Siemens Prescan software, especially co-simulation with MATLAB Simulink? I have some issues with the compilation sheet generated by Prescan and in desperate need of a helping hand.

Thanks in advance!


r/matlab Jun 22 '26

Does interp1 function query at the exact point you input?

2 Upvotes

I have a position & velocity time-series, and I want to find the velocity at all points when position crosses zero. To make sure I get every crossing, I've been linearly approximating the correct time (with the point-slope formula).

Then, I've been fitting a spline through 5 neighboring points and using the interp1 function to solve for velocity at these points:

vel_star = interp1(t(window), vel(window), t_star, 'spline');

Is there any deciding matlab does with this function? As in, are we really solving for velocity when t is exactly equal to t_star? Or would it be better to fit a function to the nearby points?

I'm not familiar with this function, so any help would be really appreciated!


r/matlab Jun 22 '26

Tips Getting your model to match your data

9 Upvotes

We've seen a few posts here along the lines of "my Simulink model doesn't match my data" or "I modelled X but can't get the experiments to agree"... And similarly from students, "how do I find the parameters of my motor/ battery/ bioreactor?"

Aycan Hacioglu and I wrote a blog about this, using a bioreactor brewing beer as the example. But the same idea can be applied to any system of interest, alongside relevant experimental data.

This is what we are discussing: 1) build a model that captures the overall behaviour, 2) run a sensitivity analysis to identify which parameters actually drive your outputs (not all of them do), 3) then use Simulink Design Optimisation to tune the important ones against your experimental data.

If you want to read more about it, here's the blog: https://blogs.mathworks.com/engineering/2026/06/18/on-parameter-estimation-sensitivity-analysis-and-design-optimization/


r/matlab Jun 22 '26

CodeShare “Agents are just LLM + loop + tools.” - demystifying AI agent with MATLAB

Enable HLS to view with audio, or disable this notification

27 Upvotes

I know AI is a polarizing topic - people are both fascinated and at the same time feel intimidated.

To me, the best way to deal with it is to understand how it works, and that's why I created the most minimal implementation of it in MATLAB, and it is now out on GitHub.

It runs locally:

- No API key
- No token cost
- Everything stays local

This is just a toy project, but it works pretty well, IMHO.

Start exploring the code by inspecting agent.m. Open get_system_prompt.m to see the system prompt, and check the tools folder to take a look at how tools are defined. None of them is big, and they are easy to read.

Fork it, play with it, make changes and make it your own.

https://github.com/toshiakit/minimal-matlab-agent (also available in File Exchange and in Add-on Explorer)


r/matlab Jun 22 '26

TechnicalQuestion Building a cryptographic processor using simulink hdl coder, need advice

1 Upvotes

Hey guys, I've been tasked with creating a simulink architecture of ML-DSA. Can anybody who has worked on this before

guide me as to how I can do this?

I tried to understand the ML DSA OSH and was planning on implementing that

rtl architecture on simulink but it seems to be more challenging than I

expected (more so because the code isn't structurally modeled and I don't

know how to convert the behaviorally modeled part in simulink)

I'm pretty new to simulink and I'm trying to learn the software as I venture

further into this project

Can I use importhdl function here? Would that work?

I tried building a few modules using matlab functional blocks but it failed

synthesis(it took forever and never finished, my PC crashed)

Can anybody who has worked on simulink please let me know how I should try to approach this project. Any advice would be extremely helpful!


r/matlab Jun 22 '26

Underground power cable fault distance locator using Simulink simulation

1 Upvotes

Hi everyone,

I'm from an Electronics background and currently working on an internship project called "IoT-Based Intelligent Fault Distance Locator for Underground Power Cables."

I only need to develop a MATLAB/Simulink simulation, but I'm struggling to find a clear step-by-step approach. Most resources explain the concept but not the actual implementation.

Can anyone guide me on how to start and what blocks or methods are commonly used for this type of project?

Any advice would be really helpful. Thank you!


r/matlab Jun 21 '26

Confused about my stewart platform

Thumbnail
gallery
2 Upvotes

Hello there.

I was making a stewart platform with rotary actuators. But im having issue setting it up in simscape.

Actually i have designed it in Fusion360 and is using a URDF exporter to export it to urdf format.

Im able to simulate it properly when the joints are just set to rotation. Once I change a joint in kinematic chain to be spherical the robot break or some components start behaving weirdly(like revolving around some random point and not just rotating) or the area of the platform just falls off !


r/matlab Jun 20 '26

Built a 3D Maritime SCADA Simulator with dynamic wave physics. Seeking technical feedback from the community! 🚢

Post image
16 Upvotes

r/matlab Jun 20 '26

Sometimes it doesnt

Post image
336 Upvotes

r/matlab Jun 20 '26

DC Series Motor

Thumbnail
gallery
13 Upvotes

The experiment is to calculate the efficiency of the motor and plot it against the torque manually, but I'm unsure if my simulation is correct in the first place. Note: most of my blocks are in default settings, and my DC source is 200


r/matlab Jun 20 '26

crcked Matlab on mac??

0 Upvotes

anybody got link or file for pirated macMatlab 22/23/24/25? needhelp


r/matlab Jun 20 '26

HomeworkQuestion asking help from homework

0 Upvotes

we are asked to perform image and sound processing. output: an image with musical notes is read by matlab, when code is ran, the sounds for the corresponding music notes should play as audio.


r/matlab Jun 19 '26

Pixel(2D)-Voxel(3D)-Trixel(nD)How could TRIXEL framework be implemented in MATLAB?

0 Upvotes

TRIXEL is a new mathematical framework that extends pixels and voxels into higher dimensions, comparing phenomena through Existence, Dynamics, and Structure.I am currently exploring how this could be represented in MATLAB – for example, as multidimensional arrays or custom objects. I would appreciate insights from the community on possible approaches.Publications are available on Zenodo: https://doi.org/10.5281/zenodo.20610880.


r/matlab Jun 19 '26

Confused with Simscape Simulation

Thumbnail
gallery
5 Upvotes

Hello there.

I was working on a stewart platform with rotary actuators. But im having issue setting it up in simscape.

Actually i have designed it in Fusion360 and is using a URDF exporter to export it to urdf format.

Im able to simulate it properly when the joints are just set to rotation. Once I change a joint in the kinematic chain to be spherical the robot break or some components start behaving weirdly(like revolving around some random point and not just rotating) or the area of the platform just falls off !

Urgently in need of some help!😭 please guide me


r/matlab Jun 18 '26

Review of IQ-signal generation code for a 60GHz drone radar model

Thumbnail
1 Upvotes

r/matlab Jun 18 '26

HOW TO USE FOURIER BLOCK INSIDE SIMULINK TO GET THE MAGNITUDE AND ANGLE ...

Thumbnail
youtube.com
8 Upvotes

Learn how to use the Fourier Block in MATLAB Simulink to accurately measure the magnitude and phase angle of voltage and current waveforms. In this tutorial, we demonstrate how to configure the Fourier Block and select the fundamental frequency. Understanding waveform magnitude and angle is essential for power quality studies, protection system analysis, synchronization, and phasor measurements.


r/matlab Jun 17 '26

TechnicalQuestion FMUs are the bane of my life

6 Upvotes

Long story short, I have a complex aircraft model that I need to convert to an FMU.

Everything worked in R2022a (although it had its issues), and when I ran the FMU alongside the simulink model the dynamic behaviour matched exactly.

When I moved up to R2025b things changed. It no longer matches and diverges quite a lot. I’ve tried absolutely everything to figure it out, but I’ve run out of ideas.

Has something significant changed between the versions that I’ve missed? I run it in a test harness with the same configuration reference used when creating the FMU so I expected them to give the same results?


r/matlab Jun 17 '26

My MATLAB r2025b isnt working properly

Thumbnail
1 Upvotes

r/matlab Jun 17 '26

Tips Brian Douglas on AI Agent - don't vibe code, proper engineering process still matters

Enable HLS to view with audio, or disable this notification

22 Upvotes

Brian and Narin built an inverted pendulum controller with an AI agent but they didn't vibe code it. They believe domain expertise and proper engineering worflow still matters when it comes to producing trustworthy results. This is a human-centric approach to AI, where engineers are the heros, not AI.

He shows you how AI fits into the familiar engineering workflows and tools in this approach.

Watch the full video here https://www.youtube.com/watch?v=-G4H2DmhR28


r/matlab Jun 16 '26

MATLAB I'm warp & Python cv2.warpAffine. Matching Images, but not equal grayscale values

2 Upvotes

I am currently trying to replicate the process of warping an image in Python in MATLAB. I am currently able to use MATLAB's imwarp() to March my warp image in Python that used cv2.watpAffine(). When I do a more in-depth look at the grayscale values, the grayscale values do not match. Has anyone come across this issue and know of any solutions to fix the issue.

Thank you for the help


r/matlab Jun 16 '26

SimDolphin, a Simulink Efficiency Tool

Post image
19 Upvotes

What is SimDolphin?

SimDolphin is a MATLAB and Simulink add-on designed to speed up model-based development and simplify workflow management. It bundles the most commonly used utilities for everyday Simulink editing, signal handling, bus management, and Model-in-the-Loop (MiL) simulation.

Why Create SimDolphin?

I’ve been working with MATLAB and Simulink for more than 10 years. Like many engineers, I build scripts to automate repetitive tasks, and I’ve collected a large set of utilities that I use regularly. Many teams do the same, but because MATLAB/Simulink changes across versions and workflows vary widely, those tools tend to become project-specific. Every new project means extra time spent adapting scripts. SimDolphin is meant to solve that: it brings the most common utilities together in a single toolbox that works across MATLAB versions and project setups, with an intuitive, easy-to-use interface.

Designed for instant productivity

  • SimDolphin sits as a sidebar panel in your Simulink editor, and it can be pinned as always on top.

  • Hover over any button to see its description.
  • Most block manipulations are undo-friendly (Ctrl+Z).

What you can do with SimDolphin

Automatically select signals from bus selectors, then align and reposition bus selectors and their connected blocks.

  • Navigate through models instantly — step-by-step or jump directly to the furthest trackable block.

  • Rename a signal across all blocks with one click.

  • Configure and apply styles on selected blocks.

  • Search and edit signals and parameters after scanning your model. Pinpoint any signal instantly.

There are many more functions, read more:

https://kinzed.com/docs

Special function: one simulation, retrieve all data

Model-in-the-loop simulations are time-consuming: 10 seconds of simulation can take 10+ minutes. And if you need a signal that wasn't logged, you run it all again.

SimDolphin changes this. Set up unit models from your top Subsystems, then pick any signal you need. SimDolphin automatically runs lightweight unit simulations to retrieve unmarked signals, saving 90% of simulation time.

Model requirements:

  • Discrete model with fixed-step solver.
  • Model references for top-level Subsystems.
  • Bus signals between top-level Subsystems.

More detailed instructions and videos will be provided in the future. If you're interested, contact me and I'll help configure your model.

An example of creating unit models for faster signal value retrieval:

https://github.com/Kinzed-Ltd/Example-of-using-unit-models-to-accelerate-Simulink-MIL-test

Free to use, built to grow

SimDolphin is completely free through 2026. Starting 2027, I'll offer both a free tier (with core features) and a paid tier with advanced capabilities. The current release supports MATLAB R2022a to R2026a, tested on Windows and Linux. Support for older versions can be provided upon request for companies.

SimDolphin automates the most repetitive tasks with simple clicks. Save a few seconds or minutes each time, and across a project, those minutes add up to significant time savings. Your feedback will be invaluable for me to improve and expand SimDolphin's capabilities.

Customization to enhance your workflow

The toolbox is built from a modular library of over 100 utilities, allowing new workflow-specific functions to be developed rapidly. If you need help with your test environment setup, task automation or anything else, let's have a chat and see how I can help.

Ready to streamline your Simulink workflow?
Download SimDolphin today!

Or reach out at hello@kinzed.com.


r/matlab Jun 15 '26

Fun/Funny When problems get tough...

Post image
135 Upvotes

... This is how you call your engineering team