Summon sinusoids representing the grid and SM
[phA, phB, phC, t] = getThreePhiSinusoid(freqGrid, 4, 380); % Grid
[phR, phS, phT, ~] = getThreePhiSinusoid2(freqSM, 4, 380, 45); % SM
% Plot the grid and SM voltages seperately
legend('v_{An}', 'v_{Bn}', 'v_{Cn}')
ylabel('V_{phase-neutral} (V)')
xlim([0, 4*1e3/freqGrid])
title("Grid Voltage vs. Time Graph")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
saveas(gcf, "pd_E.d.grid.emf")
saveas(gcf, "pd_E.d.grid.png")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
legend('v_{Rn}', 'v_{Sn}', 'v_{Tn}')
ylabel('V_{phase-neutral} (V)')
title("Machine Terminal Voltage vs. Time Graph")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
saveas(gcf, "pd_E.d.sm.emf")
saveas(gcf, "pd_E.d.sm.png")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% V_A and V_R Plot on X-T mode:
legend('v_{An}', 'v_{Rn}')
ylabel('V_{phase-neutral} (V)')
title("Phase A and R Voltages vs. Time Graph")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
saveas(gcf, "pd_E.e.emf")
saveas(gcf, "pd_E.e.png")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Difference plot on X-T mode:
ylabel('v_{R} - v_{A} (V)')
title("Voltage Difference Between Phase A and R vs. Time Graph")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
saveas(gcf, "pd_E.f.emf")
saveas(gcf, "pd_E.f.png")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% V_A and V_R plot on X-Y mode:
peakVal = 380*sqrt(2)/sqrt(3);
plot([-peakVal peakVal], [-peakVal peakVal] ) % Diagonal Line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
saveas(gcf, "pd_E.i,.emf")
saveas(gcf, "pd_E.i.png")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The diagonal line corresponds to the instant when the voltages at A and R are equal. That is, the zero voltage crossings of the
waveform. The diagonal line appears periodically with period 1 second.
function [ph1, ph2, ph3, t] = getThreePhiSinusoid(freq, timeEnd, vllrms)
t = linspace(0, timeEnd, 1e5);
ph2 = vln*sin(theta - 2*pi/3);
ph3 = vln*sin(theta + 2*pi/3);
function [ph1, ph2, ph3, t] = getThreePhiSinusoid2(freq, timeEnd, vllrms, phaseShiftDeg)
t = linspace(0, timeEnd, 1e5);
phaseShift = deg2rad(phaseShiftDeg);
ph1 = vln*sin(theta - phaseShift);
ph2 = vln*sin(theta - 2*pi/3 - phaseShift);
ph3 = vln*sin(theta + 2*pi/3 - phaseShift);