小编eng*_*sub的帖子

使用傅里叶分析来拟合数据功能

我有Y的24个值,Y值的相应24个值是通过实验测量的,

而t有值: t=[1,2,3........24]

我想用傅里叶分析找到Y和t之间的关系,

我尝试和做过的是:

我写了以下MATLAB代码:

Y=[10.6534
    9.6646
    8.7137
    8.2863
    8.2863
    8.7137
    9.0000
    9.5726
   11.0000
   12.7137
   13.4274
   13.2863
   13.0000
   12.7137
   12.5726
   13.5726
   15.7137
   17.4274
   18.0000
   18.0000
   17.4274
   15.7137
   14.0297
   12.4345];

ts=1; % step

t=1:ts:24; % the period is 24 

f=[-length(t)/2:length(t)/2-1]/(length(t)*ts); % computing frequency interval

M=abs(fftshift(fft(Y)));

figure;plot(f,M,'LineWidth',1.5);grid % plot of harmonic components

figure;

plot(t,Y,'LineWidth',1.5);grid % plot of original data Y

figure;bar(f,M);grid % plot of harmonic components as bar shape
Run Code Online (Sandbox Code Playgroud)

条形图的结果是:

在此输入图像描述

现在,我想找到代表数据的这些谐波分量的等式.之后我想用拟合函数中找到的数据绘制原始数据Y,两条曲线应该彼此接近.

我应该使用cos或sin或-sin还是-cos?

换句话说,将这些谐波表示为函数的规则是什么Y = f (t)

algorithm math matlab fft

1
推荐指数
1
解决办法
4575
查看次数

标签 统计

algorithm ×1

fft ×1

math ×1

matlab ×1