square wave with different duty cycle???

10 visualizaciones (últimos 30 días)
Muhammad Salman Bashir
Muhammad Salman Bashir el 24 de Sept. de 2019
Comentada: Walter Roberson el 1 de Oct. de 2019
i want to draw square wave with different duty cycle???
thank you for your consideration.....

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 24 de Sept. de 2019
Editada: KALYAN ACHARJYA el 24 de Sept. de 2019
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 comentarios
Muhammad Salman Bashir
Muhammad Salman Bashir el 1 de Oct. de 2019
thank you for reply but i want set different duty cycle according to my desire in one wave.......
Walter Roberson
Walter Roberson el 1 de Oct. de 2019
Create a segment with one duty cycle, create a segment with a different duty cycle, concatenate the two with with the [] list operator.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by