How to create variable-frequency PWM

66 次查看(过去 30 天)
Hi all,
I am trying to create a variable-frequency PWM waveworm. That is, I want to be able to control frequency using an input signal or a variable that changes over time continuously.
I thought the easiest way to do this would be to use the "pulse generator" block and set the period to a variable. The next question of course is how to create a continuous time variable (such as a ramp) to dictate this. I don't know how to do this in either Matlab or Simulink.
I understand there are many ways to solve this problem. One way would be to stablish a variable name in Simulink that I can use as a variable in other blocks. Is this possible? If not, how else can I go about creating a variable frequency PWM waveworm (without getting too complicated creating my own subsystem). Should be very simple...
Thanks very much,
-Dan

回答(2 个)

Dorai Yelaverthi
Dorai Yelaverthi 2018-2-19
Hi, These are the two methods(see screenshot below) I have figured out to do this.
The above two methods produce a sawtooth waveform that you can use as carrier for the PWM comparator. Just replace the constant (Frequency1 or Frequency2) blocks with any signal or variable you want to use to control the frequency. In the example simulink file variable frequency sawtooth (hyperlinked) a constant 100kHz sawtooth of amplitude 1 is generated.

rami ghali
rami ghali 2018-3-9
hello I have tried the above design however I am not getting a sawtooth at the scope
  1 个评论
Dorai Yelaverthi
Dorai Yelaverthi 2018-3-10
I just verified and it works fine. If you download the simulink file (hyperlinked in my original answer) and run it without editing any thing it should generate a 100 kHz sawtooth. The same simulink model is submitted by me to Matlab File Exchange with name 'variable frequency sawtooth carrier for PWM'. Download this and just run.
One important parameter that you have to change would the max step size of the simulation. I recommend you setting it to atleast 10 times (preferably 100) lower than the time period of the sawtooth waveform. In the simulink file provided I set the maximum step size in solver options to be 1e-7 since the frequency of the carrier was 1e5. There isn't a lot that can go wrong here.

请先登录,再进行评论。

社区

更多回答在  Power Electronics Control

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by