function y = rectifier(x)
Vrms = x(1); % Tegangan AC RMS
Vd = x(2); % Tegangan DC pengendali
B = 1; % Pembatas tegangan
if Vd <= -B
    y = - Vrms;
elseif Vd <= 0
    alpha = (pi/B)*Vd + pi; % sudut penyalaan alpha
    K = real(sqrt(1 - (alpha/pi) + (sin(2*alpha))/(2*pi)));
    y = - Vrms*K;
elseif Vd <= B
    alpha = -(pi/B)*Vd + pi; % sudut penyalaan alpha
    K = real(sqrt(1 - (alpha/pi) + (sin(2*alpha))/(2*pi)));
    y = Vrms*K;
else
    y = Vrms;
end