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

📄 fre_sample_fir_tri.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
% Name:fre_sample_fir_tri.m
clear,close all;
N=input('Type in the length N=');
k=0:N-1;
w=pi*k;
H=w.*(u(w)-u(w-0.2*pi))-(w-0.4*pi).*(u(w-0.2*pi)-u(w-0.4*pi));
%k=0:N-1;
phai=-pi*k*(N-1)/N;
H=H.*exp(i*phai);
kc=N/2;
He=conj(H);
for i=0:kc+1
    H(N-(i+1))=H(mod(-(i+1),N));
end
subplot(221)
stem(w/pi,abs(H),'.');grid on
axis([0,1,0,1])
title('The sampled frequency response of Hd')
h=ifft(H,N);
subplot(222)
n=0:N-1;
stem(n,h,'.');grid on
title('The impulse response h(n) of an FIR filter')
%axis([0,N-1,min(h),max(h)])

H=fft(h,1024);
k=0:1023;
subplot(223)
plot(k,abs(H))
%axis([0,pi,0,1]);
grid on

subplot(224)
plot(k,20*log10(abs(H)))
%axis([0,1,-100,0])

⌨️ 快捷键说明

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