Square wave

조회 수: 6 (최근 30일)
Frandy
Frandy 2011년 11월 12일
댓글: Valeska Pearson 2015년 1월 9일
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?

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 12일
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
Valeska Pearson
Valeska Pearson 2015년 1월 9일
What does the RESOLUTION mean? Why is it a 1000?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by