a1111.m
来自「matlab算法集 matlab算法集」· M 代码 · 共 38 行
M
38 行
%----------------------------------------------------------------
% Example a1.11.1: Digital Signal Processing
%----------------------------------------------------------------
% Initialize
clc % clear command window
clear % clear variables
p = 30; % select order
r = 2*p + 1; % number of terms
n = 256; % number of samples
fs = 1000; % sampling frequency
u = zeros(n,1); % input signal
h = zeros(n,1); % pulse response
x = zeros(r,1); % initial state vector
% Compute filter coefficients
fprintf ('Example a1.11.1: Digital Signal Processing\n\n');
b = fir ('funa1111',p);
% Compute pulse response
disp('Computing pulse response ... ')
t = [0 : 1/fs : (n-1)/fs]';
u(1) = 1;
for k = 1 : n
[x,h(k)] = arma (u(k),b,x,0,2*p);
end
graphxy (t(1:100),h(1:100),'Pulse Response','t (sec)','h(t)')
% Compute frequency response
[a,phi,f] = freqrsp (u,h,fs);
graphxy (f(1:n/2),a(1:n/2),'Magnitude Response','f (Hz)','A(f)');
%----------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?