script function pulse rectangle PWM with duty cycle in simulink

I can't make the pulse width repeat in every time period. I just need that in the code

5 comentarios

Can you elaborate? Are you trying to generate the pulse using MATLAB function block?
The ultimate te block copy and paste, the first block i create the function, i try create pulse block using matlab function with amplitude, duty cycle, frequency variables
can you please send the code in english?
Julio Vela
Julio Vela el 12 de Feb. de 2021
Editada: Julio Vela el 12 de Feb. de 2021
its easy translate:
function PWM = fcn(amplitude,duty_cycle,requency,clock)%generator PWM
% *** declaración de variables ***
periode=1/frequency;%periodo=period
iduty=duty_cycle/100;
ton=iduty*periode;
toff=periode-ton;
if ((mod((clockt),periode)<=(0)))
PWM=amplitude;
else
PWM=0;
end
end
i resolved the problem!!!
https://www.youtube.com/channel/UCN7owHyMvoT7I6dv2eah6dA/videos

Respuestas (0)

La pregunta está cerrada.

Preguntada:

el 14 de Oct. de 2020

Cerrada:

el 2 de En. de 2026

Community Treasure Hunt

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

Start Hunting!

Translated by