您的位置:首页 > 编程语言 > MATLAB

【matlab】频域滤波函数lpfilt()

2016-08-27 15:02 253 查看

【matlab】频域滤波函数lpfilt()

function [ H, D ] = lpfilter( type,M,N,D0,n )
%LPFILTER creates the transfer function of a lowpass filter.
%   Detailed explanation goes here

%use function dftuv to set up the meshgrid arrays needed for computing
%the required distances.
[U, V] = dftuv(M,N);

%compute the distances D(U,V)
D = sqrt(U.^2 + V.^2);

%begin filter computations
switch type
case 'ideal'
H = double(D <= D0);
case 'btw'
if nargin == 4
n = 1;
end
H = 1./(1+(D./D0).^(2*n));
case 'gaussian'
H = exp(-(D.^2)./(2*(D0^2)));
otherwise
error('Unkown filter type');

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: