Clear Filters
Clear Filters

Cycle by Cycle Average of switching signal in SIMULINK

6 views (last 30 days)
Hi MATLAB Community,
I have been trying to find cycle by cycle average of a switching signal in MATLAB. For example, these three switching signals when passed through a moving average block with average time of 1/switching frequency give their perfect average in other softwares as shown below. I want to do the same thing in SIMULINK.
I deally, I would want the average of yellow switching signal (SCOPE1 in the ATTACHED FILE). The moving average block in SIMULINK does not give the desired results. Thanks

Accepted Answer

Mathieu NOE
Mathieu NOE on 26 Jan 2024
hello
I would suggest that any well designed low pass filter after the PWM signal should give you the original waveform
here my little demo attached (i could not really use your file) , generated with (R2020b) Simulink Version 10.2
here you can see the LP filtered PWM signal correctly follows the analog input signal that enters the comparator
before starting the slx file , you need to run this (for configuration) :
Fs = 1e5;
dt = 1/Fs;
sig_freq = 2; % Hz
% PWM low pass filter
fc = 25;
[B,A]=butter(3,2*fc/Fs);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!