One way to produce a 12 pulse in Matlab is to use the built-in function called "square". This function generates a square wave with a specified duty cycle and frequency.
To generate a 12 pulse, we need to create a square wave with a duty cycle of 50% and a frequency of 6 times the fundamental frequency. Here's the code to generate the 12 pulse:
main.m393 chars16 lines
This code creates a time vector t
that ranges from 0 to the period of the fundamental frequency, with a step size of 1/sampling frequency. It then creates a square wave with a frequency of 6 times the fundamental frequency and a duty cycle of 50%. Finally, it plots the square wave.
Note that the sampling frequency fs
must be at least twice the frequency of the square wave to avoid aliasing.
gistlibby LogSnag