How can I make a square wave plot with discontinuity points?

Respuestas (1)

Hi Adrian,
If you can create a variable that contains exactly multiples of 180 as a function of the time array, then it's practically automatic:
T = 10 % the period
t = (0:2000)/50;
y = sign(sind(360*t/T)); % or cosd
plot(t,y,'o-')

1 comentario

Fabulously simple! After hours of searching and errors in MATLAB, this is exactly what I needed. Thank you!

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Mzo. de 2018

Comentada:

el 16 de Abr. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by