How we can change a Duty Cycle for a signal
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Image Analyst
2013 年 9 月 15 日
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 件のコメント
Image Analyst
2013 年 9 月 17 日
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dialog Boxes についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!