Generation of SPWM waveform with dead-time for a new circuit topology inverter using MATLAB

8 views (last 30 days)
Hello MathWorks Community,
I am currently working on a project where I need to generate a Sinusoidal Pulse Width Modulation (SPWM) waveform that includes dead-time for a new inverter circuit topology. I intend to use MATLAB for this task, but I am having difficulty figuring out how to get started.
An important aspect of this problem is that the reference signal (sinusoidal) I want to use is not the typical M*sin(ωt), but rather (1/(2-M*sin(ωt))). I would appreciate if you could consider this when giving me advice on how to proceed.
Does MATLAB have built-in functions that can be used for generating such SPWM waveforms? If so, what are these functions and how can they be utilized effectively? Also, are there any recommended methods for handling the dead-time and the peculiar reference waveform in this context?
If you have examples or tutorials that are closely related to this problem, I would be very grateful if you could share them.
Thank you in advance for your support.

Accepted Answer

Suraj Kumar
Suraj Kumar on 8 Aug 2024
Hi Silumin,
To generate a Sinusoidal Pulse Width Modulation (SPWM) waveform with dead-time for inverter circuit topology, follow these detailed steps:
1. Define the necessary parameters like frequencies, modulation index, dead-time, and the time vector. Using these parameters and reference signal create a triangular carrier signal using the “sawtooth function.
fs = 50000; % Sampling frequency (Hz)
fc = 2000; % Carrier frequency (Hz)
fm = 50; % Modulating signal frequency (Hz)
M = 0.8; % Modulation index
dead_time = 10e-6; % Dead-time
t = 0:1/fs:0.05; % Time vector
omega_m = 2 * pi * fm;
ref_signal = 1 ./ (2 - M * sin(omega_m * t));
carrier_signal = sawtooth(2 * pi * fc * t, 0.5);
2. Generate the SPWM signal by comparing the reference signal with the carrier signals.
% Generate the SPWM signal
spwm_signal = ref_signal > carrier_signal;
3. Introduce dead time by delaying the SPWM signal to ensure that there is a brief period during which both switches are off, preventing short circuits.
% Apply dead-time
dead_time_samples = round(dead_time * fs);
spwm_signal_delayed = [zeros(1, dead_time_samples), spwm_signal(1:end-dead_time_samples)];
4. Plot the reference signal, carrier signal, and both the original and delayed SPWM signals to visualize the results.
figure;
subplot(3,1,1);
plot(t, ref_signal, 'LineWidth', 1.5);
grid on;
subplot(3,1,2);
plot(t, carrier_signal, 'LineWidth', 1.5);
grid on;
subplot(3,1,3);
plot(t, spwm_signal, 'LineWidth', 1.5);
hold on;
plot(t, spwm_signal_delayed, 'LineWidth', 1.5);
title('SPWM Waveform with Dead-Time');
legend('Original SPWM', 'SPWM with Dead-Time');
grid on;
You may refer to the output for better understanding:
To know more about the “sawtooth” waveform in MATLAB, please go through the documentation linked below:
Hope this works for you!
  3 Comments
Silumin
Silumin on 1 Oct 2024
In addition, I would like to know.
How do I use the SPWM waveform generated by this code as a switching pattern for my device in simulink?

Sign in to comment.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!