How to plot PWM bars?

Hi guys,
I am trying to plot the pwm data from the following data:
if true
pw=[0 1.5e-06 3.04e-06 4.57e-06 6.09e-06]; %pulse width
sw=[6.5e-05 6.34e-05 6.19e-05 6.04e-05 5.89e-05]; %space width
end
period is 65e-6. How can I plot the data like bars with the above pw and sw at each period?

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 12 月 26 日

0 投票

start_positions = reshape(cumsum(reshape([pw; sw], [], 1)), 2, []);
yvals = repmat([0 1], 1, size(start_positions,2));
stairs(start_positions(:), yvals(:))
or something like that.

コミュニティ

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

質問済み:

2013 年 12 月 26 日

回答済み:

2013 年 12 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by