Hello I'm having a problem creating a square wave where i can change the pulse width and amplitude as need. Can anyone help point me in the right direction?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Nov. de 2011

0 votos

RESOLUTION = 1000; %whatever is appropriate
DUTYCYCLE = 0.73; %e.g. 73% on, 27% off
NUMBEROFCYCLES = 18; %as appropriate
basepulse = ones(1,RESOLUTION);
squarepulse = basepulse;
squarepulse(floor(DUTYCYCLE * RESOLUTION) + 1 : end) = 0;
wavetrain = repmat(squarepulse, 1, NUMBEROFCYCLES);

1 comentario

Valeska Pearson
Valeska Pearson el 9 de En. de 2015
What does the RESOLUTION mean? Why is it a 1000?

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 12 de Nov. de 2011

Comentada:

el 9 de En. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by