【问题标题】:Fit a Fourier Model with zero a0拟合零 a0 的傅立叶模型
【发布时间】:2015-07-17 17:45:09
【问题描述】:

以下代码查找傅里叶级数中的系数

load enso;
f = fit(month,pressure,'fourier2');

代码输出:

 General model Fourier1:
 f(x) =  a0 + a1*cos(x*w) + b1*sin(x*w)
 Coefficients (with 95% confidence bounds):
   a0 =       10.63  (10.22, 11.03)
   a1 =       2.876  (2.187, 3.565)
   b1 =       1.177  (0.09191, 2.261)
   w =      0.5263  (0.5225, 0.5301)

我需要找到函数 f(x) = a1*cos(x*w) + b1*sin(x*w) 的系数,所以 a0 应该是 0 或者根本不应该在公式中。如何做到这一点?

【问题讨论】:

  • 为什么你特别希望截距项为 0?你这样做的理由是什么?
  • 因为在合成湍流生成的方法中作者使用了没有a0的分解

标签: matlab fft data-fitting


【解决方案1】:

你想要'fourier1' 还是'fourier2'?因为你的问题都有。您可以使用拟合选项将 a0 限制为 0。以下是两者的匹配项,-InfInfabw 的范围,而 00 是限制 a0

load enso;

ft1 = fittype('fourier1');

options1 = fitoptions(ft1);
options1.Lower = [0 -Inf -Inf -Inf];
options1.Upper = [0  Inf  Inf  Inf];

f1 = fit(month,pressure,ft1,options1)

ft2 = fittype('fourier2');

options2 = fitoptions(ft2);
options2.Lower = [0 -Inf -Inf -Inf  -Inf  -Inf];
options2.Upper = [0  Inf  Inf  Inf   Inf   Inf];

f2 = fit(month,pressure,ft2,options2)

编辑:

对我来说运行良好。这很奇怪……

f1 = 

     General model Fourier1:
     f1(x) =  a0 + a1*cos(x*w) + b1*sin(x*w)
     Coefficients (with 95% confidence bounds):
       a0 =           0  (fixed at bound)
       a1 =       2.258  (-1.631, 6.148)
       b1 =       2.406  (-1.317, 6.13)
       w =      0.5311  (0.516, 0.5462)

【讨论】:

  • 它表示不允许相同的下限和上限。我需要'fourier1',抱歉没有注意到我同时使用了。
  • 我没有收到那个错误,你能把所有的; 去掉并发布结果吗?
猜你喜欢
  • 2012-10-08
  • 2016-03-25
  • 2014-06-27
  • 1970-01-01
  • 2019-03-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-03
相关资源
最近更新 更多