1

在 MATLAB 中,我需要生成高斯窗口的二阶导数以应用于表示曲线高度的向量。我需要二阶导数来确定拐点和最大值沿曲线的位置。表示曲线的向量可能是相当有噪声的,因此使用了高斯窗。生成此窗口的最佳方法是什么?最好使用 gausswin 函数生成高斯窗口,然后对其进行二阶导数?或者使用高斯二阶导数的方程手动生成窗口?或者甚至最好将高斯窗口应用于数据,然后对其进行二阶导数?(我知道最后两个在数学上是相同的,但是对于离散数据点,我不知道哪个更准确)

高度向量的最大长度约为 100-200 个元素。

谢谢克里斯

4

1 回答 1

1

I would create a linear filter composed of the weights generated by the second derivative of a Gaussian function and convolve this with your vector.

The weights of a second derivative of a Gaussian are given by:

Second Derivative of a Gaussian

Where:

  • Tau is the time shift for the filter. If you are generating weights for a discrete filter of length T with an odd number of samples, set tau to zero and allow t to vary from [-T/2,T/2]
  • sigma - varies the scale of your operator. Set sigma to a value somewhere between T/6. If you are concerned about long filter length then this can be reduced to T/4
  • C is the normalising factor. This can be derived algebraically but in practice I always do this numerically after calculating the filter weights. For unity gain when smoothing periodic signals, I will set C = 1 / sum(G'').

In terms of your comment on the equivalence of smoothing first and taking a derivative later, I would say it is more involved than that. As which derivative operator would you use in the second step? A simple central difference would not yield the same results.

You can get an equivalent (but approximate) response to a second derivative of a Gaussian by filtering the data with two Gaussians of different scales and then taking the point-wise differences between the two resulting vectors. See Difference of Gaussians for that approach.

于 2013-10-09T13:41:26.150 回答