Is it possible to generate a PWM signal in a real-time model with a pulse width resolution smaller than the fixed time step of the model?

12 ビュー (過去 30 日間)
I am developing a simulink real-time model that should output several PWM signals to control a series of servo motors. Since this is a real-time model, I have to use a fixed time step when executing the model and this is where I have encountered a problem. I need the PWM signal to have a resolution of about 10 microseconds. I have found that the only way to achieve this resolution is to likewise set the time step of the model to 10 microseconds. Unfortunately, running the model with this time step requires way to much processing power and is overloading my CPU.
Is there any way I can run my real-time simulink model with a more reasonable time step (0.01 to 0.001 second) and still generate a PWM signal with the pulses having a resolution of 10 microseconds?


Dimitri MANKOV
Dimitri MANKOV 2022 年 8 月 12 日
Hi Findlay,
Absolutely, this is possible, though you would probably not use the CPU of your target machine for this purpose. If you're using Simulink Real-Time, then you probably have Speedgoat hardware as well.
Speedgoat offers FPGA-based solutions for applications where a faster sampling frequency and signal post-processing are required, such as PWM generation and capture, quadrature encoding/decoding, protocols like I2C, SPI, etc. I highly encourage you to have a look at the code modules offered by Speedgoat for their FPGAs.
An alternative would be to use one of Speedgoat's Programmable FPGAs with HDL Coder to deploy your own algorithms to it.
I hope this is helpful!

その他の回答 (0 件)


Help Center および File ExchangeHardware-in-the-Loop Simulation with Simulink Real-Time についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by