f1 = 3; f2 = 20; dt = 0.02; Fs = 1/dt; t = 0 : dt :3; N = 50; H = [3.01778760102670e-05,-0.000187728346057455,-7.47226846259967e-05,0.000876904751770989,-0.000483373558576602,-0.00176180975398610,0.00225462402862927,0.00184821678533358,-0.00521751601179704,0.000215333994421375,0.00828544275589771,-0.00544749643903886,-0.00928041609832240,0.0137395372128861,0.00538611622319299,-0.0232718049498736,0.00612680738300263,0.0303022081336673,-0.0274645973292415,-0.0289370198513756,0.0615693981914404,0.00816703352916371,-0.122797463348812,0.0835599084671365,0.502551264449283,0.502551264449282,0.0835599084671364,-0.122797463348812,0.00816703352916371,0.0615693981914404,-0.0289370198513756,-0.0274645973292415,0.0303022081336673,0.00612680738300263,-0.0232718049498736,0.00538611622319299,0.0137395372128861,-0.00928041609832240,-0.00544749643903886,0.00828544275589771,0.000215333994421375,-0.00521751601179704,0.00184821678533358,0.00225462402862927,-0.00176180975398610,-0.000483373558576602,0.000876904751770989,-7.47226846259967e-05,-0.000187728346057455,3.01778760102670e-05]; x = sin(2 * pi * f1 * t) + cos(2 * pi * f2 * t) N_FFT = 400; FFT_x = abs(fft(x,N_FFT)); abs_FFT_x = fftshift(FFT_x); f = (-N_FFT / 2 : N_FFT / 2 - 1) * Fs / N_FFT; figure(1); plot(f,abs_FFT_x); FFT_H = abs(fft(H,N_FFT)); abs_FFT_H = fftshift(FFT_H); f = (-N_FFT / 2 : N_FFT / 2 - 1) * Fs / N_FFT; figure(2); plot(f,abs_FFT_H);
时间: 2024-03-15 07:42:01 浏览: 67
这段代码看起来像是在进行信号处理方面的工作,其中包括了一个滤波器的设计和信号的频谱分析。具体来说,代码中定义了一个长度为50的滤波器H,用于对输入信号x进行滤波。滤波器的设计可能是基于某种滤波器设计方法,比如fir1函数。然后,代码中生成了一个混合了两个频率的信号x,并对其进行了FFT变换和频谱分析,以显示信号频域上的信息。最后,代码还对滤波器H进行了FFT变换和频谱分析,以显示滤波器的频率响应。
阅读全文