top of page

PWM Pulse Generation in MATLAB

PWM Pulse Generation in MATLAB


Welcome to LMS Solution! In today's tutorial, we'll explore how to generate periodic impulses using MATLAB, specifically for converter control applications. Periodic impulses are often generated using Pulse Width Modulation (PWM) techniques. In this tutorial, we'll focus on creating pulses through the comparison of a triangular waveform and explore the concepts of PWM in MATLAB.

MATLAB Simulation Setup:

  1. Open MATLAB and navigate to the Simulink browser.

  2. Access Simscape > Power Systems > Specialized Technology > Fundamental Blocks > Control and Measurements.

  3. Select the Triangle Wave Generator block to create a triangular waveform.

Single-Phase PWM Implementation:

For a single-phase system, we use the Triangle Wave Generator block. The generated triangular waveform is then compared with a constant value representing the duty cycle. The comparison result is obtained using a relational operator, creating a pulse.

Here's a step-by-step breakdown:

  1. Triangle Wave Generator Setup:

  • Set the frequency, phase angle, and sample time for the triangular waveform.

  • The waveform has a default amplitude range of +1 to -1.

  1. Constant Block for Duty Cycle:

  • Introduce a constant block to provide a duty cycle value.

  • The duty cycle is adjusted by changing the constant value.

  1. Relational Operator:

  • Use a relational operator to compare the triangular waveform with the duty cycle.

  • The output will be 1 when the triangular waveform is greater than the duty cycle; otherwise, it will be 0.

  1. Scope Display:

  • Utilize a scope to visualize the input triangular waveform, the duty cycle, and the generated pulse.

  1. Simulation:

  • Simulate the model to observe the results.

Simulation Results:

By adjusting the duty cycle, you can observe changes in the generated pulse width. The pulse generation logic is based on the comparison of the triangular waveform and the duty cycle value. The scope provides a clear visualization of the input, duty cycle, and the resulting pulse.

PWM with Different Waveforms:

You can apply the same PWM concept using different waveforms, such as the Sawtooth waveform. The process involves adjusting the waveform parameters and observing the pulse generation.


Generating periodic impulses is a fundamental aspect of converter control in power systems. MATLAB's Simulink environment, combined with Simscape blocks, facilitates the visualization and analysis of PWM techniques. By manipulating waveform parameters and duty cycles, engineers can fine-tune converter control logic.

4 views0 comments


bottom of page