Info

この質問は閉じられています。 編集または回答するには再度開いてください。

About rectangular pulse wave function code.

1 回表示 (過去 30 日間)
Junu Lee
Junu Lee 2020 年 5 月 8 日
閉鎖済み: Sabin 2024 年 12 月 13 日
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 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by