Square wave
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Frandy
le 12 Nov 2011
Commenté : Valeska Pearson
le 9 Jan 2015
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?
0 commentaires
Réponse acceptée
Walter Roberson
le 12 Nov 2011
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 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Waveform Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!