Info
この質問は閉じられています。 編集または回答するには再度開いてください。
About rectangular pulse wave function code.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!