I am trying to simulate a 3-phase, 2-level inverter connected to the AC grid in MATLAB, using sinusoidal PWM pulses generated by taking reference from grid voltage. source voltage(phase rms)=220v;

from the images ,you can see that the reference voltage has a phase angle 0, but the inverter phase voltage has a phase angle of -0.9 degrees(similarly for phase b -1.5 degrees,for phase c -0.3 degrees ). What is the reason of his phase angle and how can I remove this phase difference.

[The abc/dq and dq/abc are for other purpose ,here I just placed them to just check whether the blocks are working or no and the phase lag is not because of these blocks they are working fine.]

#block diagram#My block diagram

#control block#control block

#reference voltage from grid reference from grid

inverter phase voltage inverter phase voltage

  • \$\begingroup\$ Hi, This looks the same as your question from 2 days ago: "Phase lag because of switches in a 3-phase, 2-level inverter connected to grid" (with some information added, and some information removed). Repeating the same question isn't allowed here - it wastes time and effort that has been invested in the first version. Instead, on Stack Exchange sites, you should edit the original question and add / update information there. Therefore I have voted to close this one, as a duplicate of the previous one. I recommend you delete this one. \$\endgroup\$
    – SamGibson
    Oct 22, 2020 at 10:37
  • \$\begingroup\$ @SamGibson sorry for this trouble. I changes my circuit and made some modification after posting previous question ,so wanted to re-post my question with new results. I deleted my previous question. Sorry again \$\endgroup\$ Oct 22, 2020 at 11:10
  • 1
    \$\begingroup\$ Hi, "I changes my circuit and made some modification [...] so wanted to re-post my question with new results. I deleted my previous question." Just because you could delete your previous question (as it didn't have an answer), doesn't mean that you should. You had a user who seemed "engaged" and was waiting for you to improve the question. That engagement has been lost. You have also shown that you are prepared to delete a question and lose the effort from readers so far to understand it, and so you might do the same to this one! Therefore I won't invest any time here. Good luck anyway! \$\endgroup\$
    – SamGibson
    Oct 22, 2020 at 11:19
  • 2
    \$\begingroup\$ 1.5 deg phase difference assuming 50 Hz supply implies a time lag of \$1/50 * 1.5/360 = 83 \mu s\$. One of your images show a block named Discrete 5e-05 s powergui. What is that block? If that block determines the step size of the simulation, it may be the reason. 83 micro seconds may also be the switching delay of the power transistors. I suggest that you run a simulation with a much smaller time step with ideal switches instead of transistors and see if the phase delay changes / goes away. \$\endgroup\$
    – AJN
    Oct 22, 2020 at 12:34
  • \$\begingroup\$ @AJN, Yes, In that powergui block, we can define step time and Thanks a lot ,your suggestion helped me to solve my problem.**boldI tried with 5e-8 and got phase delay 0 finallybold **. But there is another problem with that, with a step time this much low matlab takes a large amount of time to simulate even for getting 2 cycles of data and I had some doubts like we are using balanced source voltage and same kind of switches in each leg then why different phase delay difference for each phase. But my min problem is solved and have to move n to my next task. Thanks a lot AJN. \$\endgroup\$ Oct 22, 2020 at 16:24

1 Answer 1


As @AJN stated, reference wave frequency =50Hz

for 1.5 degrees 1/50∗1.5/360=83μs , the step time of simulations is 50μs ,so there is around 1.5 steps of delay. whatever the cause might be, if we decrease the step time even more, we can get very less time delay for 1.5 steps which means very less phase delay. For my problem I changed my step time from 5e-6 to 5e-8 and got my desired results, though the simulation takes a lot of time with this much low step size, I can get accurate results with this step time


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.