필터 지우기
필터 지우기

How to make a rectangular pulse train at 50 kHz frequency?

조회 수: 21 (최근 30일)
Rohan Repale
Rohan Repale 2013년 6월 4일
댓글: Jonathan Duncan 2017년 12월 22일
HI,
I have a code -
t = 0 : 1/1e3 : 1; % 1 kHz sample freq for 1 sec
d = 0 : 1/3 : 1; % 3 Hz repetition freq
y = pulstran(t,d,'rectpuls');
plot(t,y)
which is supposed to generate a rectangular pulse at 3 Hz how to make it 50 kHz?
When I try changing it, I dont see the pulse train any more.
Thanks

채택된 답변

Wayne King
Wayne King 2013년 6월 4일
You did not specify the width of the pulse. I've made it 10 microseconds.
t = 0 : 1/1e6 : .01;
d = 0 : 1/50e3 : .01;
y = pulstran(t,d,@rectpuls,1e-5);
plot(t,y);
axis([0 0.001 0 1.5])
  댓글 수: 1
Jonathan Duncan
Jonathan Duncan 2017년 12월 22일
why did you use the @ symbol I've been trying to do the same thing with just the '' symbols and does not work. Also could you use this for generator in arduino to control a motor or flashing light

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

추가 답변 (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