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

📄 stepres.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
% The step response and the impulse response of an ideal lowpass filter
% Name:stepres
% tao: the time delay of the filter.
% t0~t1:the time range.
% h(t):the impulse response.
% r(t):the step response.
% the cutoff frequency in terms of n*pi.

clear,close all,
p=0.01;
t0=-10;
t1=10;
t=t0:p:t1;
tao=input('input the time delay tao=:');
wc=input('input the cutoff frequency of the lowpass filter wc=:');
%h=(wc/pi)*sin(wc*(t-tao)+eps)./(wc*(t-tao)+eps);
h=(wc/pi)*sinc(wc*(t-tao)/pi);
s=p*conv(h,u(t));

l=length(s);
m=2*t0:p:t0-p;
n=t1+p:p:2*t1;
m1=zeros(1,abs(t0/p));
n1=zeros(1,abs(t1/p));
lm=length(m1);
ln=length(n1);
s=s([lm+1:l-ln]);

clf;
subplot(2,1,1)
plot(t,h);grid on;title('The impulse response h(t)')
axis([-3,3,1.2*min(h),1.1*max(h)])
subplot(2,1,2)
plot(t,s);grid on;title('The step response r(t)')
axis([-3,3,1.2*min(s),1.1*max(s)])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -