How we can change a Duty Cycle for a signal
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Suppose A = 110101011; and i want to form rectangular wave with different duty cycle of each pattern and this pattern is repeating 1000 times. how can i plot this pattern
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Sep. 2013
Do you have the Image Processing Toolbox, if so, just simply use imresize() to get the new pattern in the length that you want. Try this code:
A = [1,1,0,1,0,1,0,1,1];
newA = A; % Let's say the first cycle is the starting pattern.
for cycle = 1 : 3
% Get a random length for this pattern between 9 and 30
newSize = length(A) + randi(21, 1)
newPattern = imresize(A, [1,newSize], 'Nearest')
newA = [newA, newPattern]
end
2 Kommentare
Image Analyst
am 17 Sep. 2013
What do you mean by different duty cycles? I took your pattern and basically stretched it out by a random factor. The duty cycle in A is the same, it's just longer or shorter in each random-length stretch of data that I added on. Is that not what you meant? To have a different duty cycle, you'd have to change what's in A, not just make A longer with the same pattern. If you want us to run your code, give typical values for inputs s and t.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!