필터 지우기
필터 지우기

How to make a square wave with a pulse

조회 수: 4 (최근 30일)
katherine keogh
katherine keogh 2020년 9월 17일
답변: Star Strider 2020년 9월 17일
So I want to make a wave that is on for 1ms and off for 1ms, lasting for 10ms. Is ther a function I can use to do this?

답변 (1개)

Star Strider
Star Strider 2020년 9월 17일
This is a slight variation on the method I showed you when you presented a similar problem yesterday in How to create a square wave pulse
t = linspace(0, 10E-3); % Time Vector (0 - 10ms)
f = 5/max(t); % Desired Frequency (Cycles/Timespan)
sqwv = sign(sin(2*pi*t*f)); % Signal
figure
plot(t, sqwv, 'LineWidth',1.5)
grid
ylim(ylim*1.1)
xlabel('Time (s)')
ylabel('Amplitude')
Only the frequency changes.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by