square wave with different duty cycle???

조회 수: 5 (최근 30일)
Muhammad Salman Bashir
Muhammad Salman Bashir 2019년 9월 24일
댓글: Walter Roberson 2019년 10월 1일
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일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by