【matlab】頻域濾波函數lpfilt()

【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  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章