How to creat SPWM waveform

6 views (last 30 days)
Hein zaw
Hein zaw on 15 Jan 2019
Commented: Hein zaw on 4 Nov 2019
Hello, I want to know how to creat the SPWM waveform in matlab to put in amplifier software, arbexpress. Before that I used the signal builder block in simulink and I changed the this data in .xls file. I can change xls file in software which reconize the amplifier. Now i want to creat the SPWM waveform with different modulation ratio. Please give me the way how i can do that. Thanks.

Accepted Answer

Lucas Della Santina
Lucas Della Santina on 4 Nov 2019
clear all;
clc;
Fs = 10000000; %frecuencia de sampling (en Hz)(nota para el salame tiene q ser 10 veses mayor a la reiangular por q si no la recorta)
F_triangle =15000; %frecuencia de l; triangular
F_seno = 50 ; %frecuencia de la onda senoidal
Cant_periodos=10; %cantidad de perios de la senal seno
A_tirangle=.9 ; % amplitud de la triangular
A_seno=1 ; % amplitud de la Senoidal
T = Cant_periodos*(1/F_seno); %calculo el fianl de la cadena
t = 0:1/Fs:T-1/Fs; %vector de tiempo
Triangle= sawtooth(2*pi*F_triangle*t,1/2); %onda triangular
Seno=sin(2*pi*t*F_seno); %onda senoidal
Triangle=Triangle*A_tirangle; %modifico la aplitud de la triangular
Seno=Seno*A_seno ; %modifico la aplitud del seno
Compare = Triangle > Seno; %comparo las senales para generar el spwm
subplot(3,1,1);
plot(t,Triangle,"red",t,Seno,"blue")
title('Seno y Triangular')
grid on
subplot(3,1,2);
plot(t,Compare)
title('SPWM TR1!!!')
grid on

More Answers (0)

Community Treasure Hunt

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

Start Hunting!