square wave with different duty cycle???

i want to draw square wave with different duty cycle???
thank you for your consideration.....

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 24 日
編集済み: KALYAN ACHARJYA 2019 年 9 月 24 日

0 投票

t=linspace(0,3*pi)';
duty_cycle=60; % Percentage
x = square(t,duty_cycle);
plot(t/pi,x)
grid on
Documentation here
More plots
for i=1:10
t=linspace(0,3*pi)';
duty_cycle=randi(100); % Percentage
x = square(t,duty_cycle);
plot(t/pi,x,'*-');
hold on;
end
grid on;

2 件のコメント

Muhammad Salman Bashir
Muhammad Salman Bashir 2019 年 10 月 1 日
thank you for reply but i want set different duty cycle according to my desire in one wave.......
Walter Roberson
Walter Roberson 2019 年 10 月 1 日
Create a segment with one duty cycle, create a segment with a different duty cycle, concatenate the two with with the [] list operator.

サインインしてコメントする。

カテゴリ

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

質問済み:

2019 年 9 月 24 日

コメント済み:

2019 年 10 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by