【问题标题】:Applying bandpass in the Fourier for my signal in matlab在matlab中为我的信号应用傅里叶带通
【发布时间】:2018-08-21 19:49:29
【问题描述】:

我正在尝试在频率 0 附近应用带通,但没有运气。我很乐意得到一些帮助

x=scan11(1,:)*1e-3/3e8; y=scan11(2,:);
plot(x,y)  % my function

[XX,ff]=trans_fourier(y,mean(diff(x)));
plot(ff,abs(XX))  % gives the Fourier transform

我想选择 0 左右的频率。让我们假设 -1e13 到 1e13,而不是在这个过滤器之后进行 ifft 并绘制信号。

我应该如何开始这样做?命令

YY=bandpass(y,[-1e13 1e13],1/mean(diff(x)))

很遗憾在这里没有帮助。

因为,我不能在这里上传文件,这也是我在 matlab 论坛上的所有文件的问题

matlab link

【问题讨论】:

    标签: matlab fft bandpass-filter


    【解决方案1】:

    我不确定 trans_fourier 函数的内容究竟是什么,但在“普通 matlab 函数”中,您可以尝试以下内容。

    Nt = 1024;                     % Number of samples
    Fs = 10;                       % Sampling frequency (samples / second)
    t = (0:Nt-1)/Fs;               % Time array
    x = sin(t/10);                 % Low-frequency signal
    x = x + 0.25*randn(1,Nt);      % add some noise
    
    X = fftshift(fft(x));          % FFT of signal with 0 Hz centered
    fr = (-Nt/2 : Nt/2-1)/(Nt/Fs); % Frequency axis
    
    % Filter: squared cosine (edit as desired)
    fsl = 10;                      % Length of filter slope, in samples
    filt = zeros(size(X));
    filt(Nt/2+1+(-fsl:fsl)) = cos( linspace(-pi/2,pi/2,2*fsl+1) ).^2;
    
    x_filt = real(ifft(ifftshift( filt.*X ))); % Filtered x
    
    figure();
    subplot(2,2,1); plot(t,x);             ax=axis;  title('original signal');
    subplot(2,2,4); plot(t,x_filt);        axis(ax); title('Low-pass filtered signal');
    subplot(2,2,2); plot(fr,abs(X));       ax=axis;  title('original amplitude spectrum');
    subplot(2,2,3); plot(fr,abs(X).*filt); axis(ax); title('Filtered amplitude spectrum');
    

    我不知道你说的到底是什么意思

    假设 -1e13 到 1e13

    ,但请记住,提取单个傅里叶分量(基本上将频谱的所有值设置为零,除了您感兴趣的那个)充当砖墙滤波器,如果您采取逆变换。如果您有兴趣,请参考this topicthis page

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      相关资源
      最近更新 更多