Pulse train with duty cycle variable.

5 views (last 30 days)
Carlos Martínez
Carlos Martínez on 3 Apr 2017
Answered: Joseph Cheng on 4 Apr 2017
Hello, I want to make a Pulse train(for a simulation of the switching a dc-dc boost elevator). Here is my code.
dur=input('Please set the time the wave will last: ');
per=input('Please set the Period: ');
duty=input('Please set the Duty Cycle: ');
But I am having a lot of problems for floating numbers of periods, duty cycles and so on...
Any idea of how to improve or make it really efficient?

Answers (1)

Joseph Cheng
Joseph Cheng on 4 Apr 2017
why not try something like this:
t=0:per/1000:per-per/1000; %define period
normal = zeros(1,numel(t));
then just remap this to either equal the total duration or just above and then cut to length.

Community Treasure Hunt

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

Start Hunting!