matlab 周期数据的快速傅里叶变换 方法
%% FFT变换 参考自 https://ww2.mathworks.cn/help/matlab/math/using-fft.html
clc
clear
wvf_array1=xlsread(‘数据.xls’);
wvf_array = wvf_array1(:,7);
relNums = wvf_array; %序列数据【纵向】
y = fft(relNums); % fft变换
y(1) = []; %第一个数据要用0代替
n = length(y);
power = abs(y(1:floor(n/2))).^2; % power of first half of transform data
maxfreq = 1/2; % maximum frequency
freq = (1:n/2)/(n/2)*maxfreq; % equally spaced frequency grid
% 上面的不用变
period =(9.965/365)./freq; % 【(9.965/365)】 数据之间的间隔大小 此部分展示出来,如果没有应该是 【1】
plot(period,power);
xlim([0 8]); %zoom in on max power % 你认为的最大周期的标尺
xlabel(‘Years/Cycle’)
ylabel(‘Power’)