Generating PWM wave and Modelling RC filter in Simulink | Simulink Tutorial

MATLAB Helper Quiz

Introduction:

PWM is an abbreviation for Pulse width modulation is a modulation. Pulses encode the message signal in this technique. A PWM generator generates PWM wave by comparing a Sawtooth wave with a message signal. PWM signals have many common applications in designing a model related to a controls application, encoding messages etc.
Therefore, in this model, the message signal is considered to be a constant value. In order compare the constant value we use a compare to constant block. This further compares the input to the block with a pre-assigned value for the constant.
>>Simulink Library>>Simulink>>Logic and Bit Operations>> Compare to Constant.

A PWM generator is successfully implemented.

RC filter:

Vout=Vin(Z2/(Z1+Z2))

 

The above diagram shows the Rc filter wherein,  R is the resistance and C is the capacitance. These two components account to the impedance in the circuit. Thus, the equation of the output voltage is as given above.

Where Z1 is the impedance of the resistive part of the RC filter and Z2 is the impedance of the capacitive part of the filter.

Modeling RC filter:

Representation in the form of a transfer function:

(Vout/Vin)=1/(R*Cs+1)


Thus, we use a transfer function block. The Transfer Function block models a linear system by a transfer function of the Laplace-domain variables. The block can model single input single output (SISO) and Single input multiple output (SIMO) systems. The numerator and the denominator of the transfer function are assigned using two different matrices in the function block parameters window.
>>Simulink Library>>Simulink>>Continuous>> Transfer function.
The PWM wave generated previously is input to the RC filter. The output of PWM wave is of the type Boolean whereas, the input of transfer function block is of the data type double. Therefore, we convert the datatype of the output of PWM generator. This is done using a Convert block. Furthermore, the numerator and denominator of the transfer function are assigned as per the transfer function equation for RC filter. Finally, we see the output in the Scope.


She completed her graduation in Electronics and Telecommunication from MIT Academy of Engineering, Pune. She has recently associated herself with MATLAB Helper and enjoys providing help in MATLAB and Simulink. She has a keen interest in astronomy and always finds time to keep that part of her alive.

Leave a Reply