⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rectan.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 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 + -