Advertisement

【MATLAB】通信信号调制通用函数 — 带通滤波器

阅读量:

目录

带通滤波器


带通滤波器

复制代码
 function [t,st] = bpf(f,sf,B1,B2)

    
 %This function filter an input at frequency domain by an ideal bandpass filter
    
 %Inputs:
    
 % f: frequency samples
    
 % sf: input data spectrum samples
    
 % B1: bandpass's lower frequency
    
 % B2: bandpass's higher frequency
    
 %Outputs:
    
 % t: time samples
    
 % st: output data's time samples
    
 df = f(2)-f(1);
    
 T = 1/df;
    
 hf = zeros(1,length(f));
    
 bf = [floor(B1/df ): floor(B2/df)] ;
    
 bf1 = floor(length(f)/2) + bf;
    
 bf2 = floor(length(f)/2) - bf;
    
 hf(bf1)=1;
    
 hf(bf2)=1;
    
 yf = hf.*sf;
    
 [t,st] = F2T(f,yf);
    
 st = real(st);
    
    
    
    
    代码解读

全部评论 (0)

还没有任何评论哟~