📄 rectan.m
字号:
% The response of an ideal lowpass filter to a rectangular pulse.
% Name:rectan
% tao1: the time delay of the filter.
% tao2: the width of the rectangular pulse/
% t0~t1:the time range.
% r(t):the step response.
clear;
p=0.01;
t0=-2;
t1=10;
t=t0:p:t1;
tao1=input('Type the time delay t0=:');
tao2=input('Type the width of the rectangular pulse tao=');
wc=input('Type the cutoff frequency of the lowpass filter ');
f1=wc*sin(wc*pi*(t-tao1)+eps)./(wc*pi*(t-tao1)+eps);
f2=wc*sin(wc*pi*(t-tao1-tao2)+eps)./(wc*pi*(t-tao1-tao2)+eps);
r(1)=f1(1)-f2(1);
for i=2:((t1-t0)/p)+1
r(i)=r(i-1)+p*(f1(i)-f2(i));
end
clf;
plot(t,r);grid on;title('The response r(t)')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -