Page 344 - Solutions Manual to accompany Electric Machinery Fundamentals
P. 344
(a) To write a MATLAB simulator of this circuit, note that if v in > v x , then v u = V DC , and if v in <
v x , then v u = 0. Similarly, if v in > v y , then v v = 0, and if v in < v y , then v v = V DC . The output
voltage is then v out v v u . A MATLAB function that performs these calculations is shown below.
v
(Note that this function arbitrarily assumes that V DC = 100 V. It would be easy to modify the function to
use any arbitrary dc voltage, if desired.)
function [vout,vu,vv] = vout(vin, vx, vy)
% Function to calculate the output voltage of a
% PWM modulator from the values of vin and the
% reference voltages vx and vy. This function
% arbitrarily assumes that VDC = 100 V.
%
% vin = Input voltage
% vx = x reference
% vy = y reference
% vout = Ouput voltage
% vu, vv = Components of output voltage
338