www.gusucode.com > signal 案例源码程序 matlab代码 > signal/TransferFunctionBetweenTwoSequencesExample.m
%% Transfer Function Between Two Sequences % Compute and plot the transfer function estimate between two sequences, % |x| and |y|. |x| consists of white Gaussian noise. |y| results from % filtering |x| with a 30-th order lowpass filter with normalized cutoff % frequency $0.2\pi$ rad/sample. Use a rectangular window to design the % filter. Specify a sample rate of 500 Hz and a Hamming window of length % 1024 for the transfer function estimate. % Copyright 2015 The MathWorks, Inc. %% h = fir1(30,0.2,rectwin(31)); x = randn(16384,1); y = filter(h,1,x); fs = 500; tfestimate(x,y,1024,[],[],fs) %% % Use |fvtool| to verify that the transfer function approximates the % frequency response of the filter. fvtool(h,1,'Fs',fs) %% % Obtain the same result by returning the transfer function estimate in a % variable and plotting its absolute value in decibels. [Txy,f] = tfestimate(x,y,1024,[],[],fs); plot(f,mag2db(abs(Txy)))