필터 지우기
필터 지우기

About rectangular pulse wave function code.

조회 수: 2 (최근 30일)
Junu Lee
Junu Lee 2020년 5월 8일
function y = rect_pulse(t_vec,tau)
% This function generates a rectangular pulse of pulse width tau.
% Generated pulse is centered about t=0.
% By default, the generated pulse has width 1.
% The signal has value 1 in interval [-Tw/2,+Tw/2)
%
if nargin<2, tau=1; end
y = double(abs(t_vec)<tau/2-eps);
y(abs(t_vec-(-tau/2))<eps) = 1.0;
This code is generating the rectangular pulse wave.
but i can't understand the last two lines.
First, where the 0? fundamentally rectangular pulse has 0 except for the width range.
how can the zero make in this code?
Next, is there conditional code beside 'if' or 'elseif'?
because in 'y=double(~~)' '~~' looks like conditional code.
Thank you for your help.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Pulse and Transition Metrics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by