经过几天思考和看书,还有谢谢论坛里一些老师的指导,自己找到了程序的问题,对于采样率、实际频率、频率分辨率等概率进行了梳理,对程序进行了修改注释,现贴出来大家一起学习
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FFT提取特定频率的信号
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 创建人:Peng Jin
% 日 期:2017-09-04
% 函数变量及功能描述:采用FFT对混合信号进行分离
% 修改日期:2017-09-08
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;clc
fs = 100; % 采样频率,根据采样定理,采样频率为信号最大频率两倍
N = 100; % 采样数据点数
df = fs/N; % 频率分辨率,也就是能分辨的两个频率之间的最小差值为1HZ,所以这个值直接决定了程序能分辨的最小频率差
dt = 1/fs; % 采样时间间隔
n = (0:dt:1-dt); %在时间轴上取100个点
x1=5*cos(2*pi*5*n+pi*30/180); % 时域信号1
x2=10*sin(2*pi*10*n+pi*80/180); % 时域信号2
x3=