1. We will be in Read Only mode (no new threads, replies, registration) for several hours as we migrate the forums to upgraded software.

The SPWM in Matlab...

Discussion in 'Programmer's Corner' started by FBorges22, Jul 9, 2009.

  1. FBorges22

    Thread Starter Senior Member

    Sep 11, 2008

    I am trying to representate a SPWM comparing a 30kHz triangle wave with a 60Hz sine wave using the MatLAB. However, I do not know how to compare two functions in him. Recently I generated this graph containg the sine and the triangle wave functions... How I can generate the SPWM?

    Here is my .m script:

    Code ( (Unknown Language)):
    1. x1 = 0:0.01:20;
    2. x2 = 0:0.01:20;
    3. plotyy(x1,170*sawtooth(15*x1,0.5),x2,170*sin(x2));
    4. axis([0,20,-200,200]);
    5. title('SPWM Modulation');
    6. ylabel('Voltage (V)');
    7. xlabel('Time (s)');