📄 ctfirstorderfilter.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -