top of page
Writer's pictureLMS Solution

PWM Generator in Simulink MATLAB

PWM Generator in Simulink MATLAB


Introduction to Sinusoidal PWM Generation in MATLAB Simulink

To start with the MATLAB simulation of a Sinusoidal PWM Generator in MATLAB Simulink, follow these steps:

  1. Open Simulink: Open a blank model in Simulink.

  2. Simulink Library Browser: Click on the Simulink Library Browser.

  3. Repeating Sequence: Use the Repeating Sequence block for generating a sinusoidal waveform.

Creating Sinusoidal and Triangular Waveforms

  1. Sinusoidal Waveform:

  • Frequency: Set the sinusoidal waveform frequency, for example, 2π.

  • Time Interval: Consider the frequency is set towards, for demonstration, and create the waveform.

  1. Triangular Waveform:

  • Initial Values: Start from 0, then it goes to 1, and then to -1.

  • Time Frame: Set the time frame for the triangular wave, such as 0.0 to 0.04 seconds.

  • Frequency Calculation: The frequency is calculated as 1 divided by 0.04, resulting in 25 Hz.

Generating Sinusoidal PWM

  1. Relational Operator: Use the Relational Operator block (comparator) to compare the sinusoidal waveform with the triangular waveform.

  2. Configuration:

  • Set the relational operator to "greater than or equal to".

  • Connect the sinusoidal and triangular waveforms to the relational operator.

  1. Scope: Use the Scope block to measure the input and output waveforms. Configure the scope to have two input ports to display the waveforms.

Model Configuration and Simulation

  1. Model Configuration:

  • Set the maximum step size to a small value, such as 0.01.

  1. Simulation Time: Set the simulation time to observe two cycles of the waveforms.

  2. Scope Layout: Adjust the scope layout to display the waveforms clearly.

Simulation Results

  • The sinusoidal waveform is compared with the triangular waveform, generating the PWM signal.

  • Observe the pulse width variation as the sinusoidal waveform crosses the triangular waveform.

Generating PWM Pulses for H-Bridge Inverter

  1. Sinusoidal Waveform with Phase Shift:

  • Use the same relational operator and triangular wave.

  • Introduce a 180-degree phase shift to generate four pulses for the H-Bridge inverter.

  1. Connection:

  • Connect the sinusoidal waveform and its phase-shifted version to the relational operator.

  • Use NOT gates to invert the signals if necessary.

PWM for DC-DC Converter

  1. Triangular Waveform:

  • Set the amplitude to 0 and 1, creating an unipolar triangular wave.

  1. Constant Block:

  • Use a Constant block to set the duty cycle (e.g., 0.5 for 50% duty cycle).

  1. Scope:

  • Measure the output to observe the PWM signal based on the duty cycle.

Adjusting Duty Cycle

  • Changing the duty cycle (e.g., 0.9 for 90% on-time and 0.1 for 10% off-time) affects the pulse width.

Conclusion

This basic PWM generator in MATLAB Simulink demonstrates how to generate PWM signals for various applications such as H-Bridge inverters and DC-DC converters.

2 views0 comments

Comentarios


bottom of page