ctfirstorderfilter.m
来自「很多matlab的源代码」· M 代码 · 共 40 行
M
40 行
function [f, h] = ctfirstorderfilter(type, cutoff, bandwidth)% CTFIRSTORDERFILTER implements continuous time filters, to be used with % cltidemo. % [f, h] = ctfirstorderfilter(type, cutoff, bandwidth)% where, % type - can be one of 'Lowpass', 'Highpass', 'Bandpass' or 'Bandreject'% cutoff - is the cutoff frequency in Hz. (Max - 200 Hz)% bandwidth - for Bandpass and Bandreject filters ( 10 to 50 Hz)% f = linspace(0,200,1001); fc = cutoff ; % Bandpass filter - Bandwidth bw = bandwidth; switch type case 'Lowpass' for i=1:length(f) h(i) = 1/(1+j*f(i)/fc); end case 'Highpass' for i=1:length(f) h(i) = (j*f(i)/fc)/(1+j*f(i)/fc); end case 'Bandpass' for i=1:length(f) h(i) = (j*f(i)*bw)/(f(i)^2 - fc^2 + j*f(i)*bw); end case 'Bandreject' for i=1:length(f) h(i) = (f(i)^2 - fc^2)/(f(i)^2 - fc^2 + j*f(i)*bw); end otherwise error 'Filter type unknown or unspecified' end % endfunction ctfirstorderfilter% eof: ctfirstorderfilter.m
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?