# PWM frequency and LC filter

I'm new here, I have some fairly basic doubt. I am creating a PWM signal in MatLab by comparing a sine wave (50Hz) and a triangular wave (2kHz) .... So what is the PWM frequency will output?

After getting the PWM signal filters I want to get a sinusoid, using an LC filter, but do not know what the frequency of cut should I use?

Thanks for help

• "Comparing" is too broad. What are the exact operations you're performing? Feb 2, 2016 at 16:17
• I simply compare a triangular wave(2khz) with 1 of amplitude , with sinusoidal wave (50Hz) with 1 of amplitude, and generate pwm Feb 2, 2016 at 16:31
• Yes, you already said that. Feb 2, 2016 at 16:33

So what is the PWM frequency will output?

If your triangle wave is 2 kHz then the output PWM frequency is 2 kHz: -

After getting the PWM signal filters I want to get a sinusoid, using an LC filter, but do not know what the frequency of cut should I use?

Well an LC low pass filter has a cut-off frequency defined by: -

F = $\dfrac{1}{2\pi\sqrt{LC}}$

But, it's also a series resonant circuit so if you run either your 50 Hz or 2 kHz anywhere near that resonant point you are going to get rather large currents and, as has been mentioned in a comment a good starting point is the geometric mean i.e. 316 Hz. If you felt that the output ripple voltage (2kHz ripple) superimposed on the 50 Hz was too high you could lower the filter frequency towards 100 Hz but I'd probably use a simulator to see what the likely impact of this is. Alternatively I'd consider rasing the 2 kHz to maybe 10 kHz or higher.

• i will test this tips , that you told me , and report you the result :) thanks Feb 2, 2016 at 22:19
• I test Fc=316 Hz and I got somo good result but th amplitude of the wave after filtered decreased slightly. So after this I change de frequency of triangular to 10Khz , and made the same process , sqrt(10Khz*50Hz) = 707 Hz , so this is my starting point Fc, but in this case the result isn't good, can help me to find why please? Feb 3, 2016 at 17:58
• Let me know what values of L, C and max load current. Feb 3, 2016 at 18:46

Your pass band must extend to at least 50Hz.

Your stopband should be fully attenuating to your specification (you do have an unwanted signals specification, don't you?) by 1950Hz.

Where between those two limits you define to be the cutoff frequency of the filter (usually the -3dB point) depends on what order of filter you want to use, whether you want any excess bandwidth above 50Hz, and what your unwanted signal specification is. Some would advocate the geometric mean of Fpass and Fstop. It's a frequency that's between the two, so it has that going for it. It may not be the best to meet both your passband and stopband specifications, but it doesn't hurt to start there and see what you get.

I would choose a passband of a little more than 50Hz, and increase the filter order in a filter design program until the unwanted signals are suppressed to your specification (1%? 0.1%? 10%?). As the filter order changes, the ratio of useable passband to 'cutoff' frequency will change. As the passband is meaningful to your application, and the 'cutoff' frequency isn't, it's better to design with a passband, than with a cutoff frequency.

• So I use this equation , Fc= 1/(2*PISQRT(LC)) , and use 50 Hz to Fc? Feb 2, 2016 at 16:30
• The geometric mean $\sqrt{f_1f_2}$ is usually a good first approximation of a corner frequency. Feb 2, 2016 at 16:40
• No, get a filter design program, design a filter, get a circuit simulator, and simulate it to see whether it give you what you want. The formula you have quoted is for LC resonance, not for the cutoff or passband frequency of any type of filter. Feb 2, 2016 at 16:43
• @user44635 Resonance is the corner frequency of an LC filter. Feb 2, 2016 at 16:50
• @MattYoung I test Fc=316 Hz and I got somo good result but th amplitude of the wave after filtered decreased slightly. So after this I change de frequency of triangular to 10Khz , and made the same process , sqrt(10Khz*50Hz) = 707 Hz , so this is my starting point Fc, but in this case the result isn't good, can help me to find why please? Feb 3, 2016 at 17:57