필터 지우기
필터 지우기

HOW TO GENERATE SQUARE PULSE

조회 수: 3 (최근 30일)
mira
mira 2014년 1월 4일
답변: Hiba Jasmin 2021년 5월 25일
hi everybody,
I want to generate square pulse with different interval and the interval is random. in my case i have 1.2s 7 times,2.4s 7times and 3s 6times which will create 20 square pulse. the width is 0.07s.
anyone can help me? thanks.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 4일
편집: Azzi Abdelmalek 2014년 1월 4일
If you have signal processing toolbox, use pulstran
EDIT
Amp=1 % Pulse amplitude
Wd=0.07 % Pulse width
sp=[1.2 2.4 3];
fr=[7 7 6];
spac_vect=cumsum(cell2mat(arrayfun(@(x,y) x*ones(1,y),sp,fr,'un',0)))
amp_vect=Amp*ones(1,numel(spac_vect)) % vector of amplitudes
t=linspace(0,max(spac_vect),1000) % time vector
d = [spac_vect;amp_vect]';
y = pulstran(t,d,'rectpuls',Wd);
plot(t,y)
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 4일
Look at edit
mira
mira 2014년 1월 4일
thank you very much!

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

추가 답변 (1개)

Hiba Jasmin
Hiba Jasmin 2021년 5월 25일
How to get 2 pulses of different width?

카테고리

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