why not try something like this:
t=0:per/1000:per-per/1000; %define period
normal = zeros(1,numel(t));
normal(t<per*duty/100))=1;
then just remap this to either equal the total duration or just above and then cut to length.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!