【问题标题】:How to find minimum of each curvature point?如何找到每个曲率点的最小值?
【发布时间】:2013-09-11 04:43:50
【问题描述】:

我正在使用多项式曲线拟合来分析我的数据(polyfit 和 polyval),我得到了这样的曲线。我想找到每条曲线的最小点(红点)。如果我使用 min() 我将只得到一条曲线。如何获得两个点?

非常感谢你

【问题讨论】:

  • 您可以使用findpeaks 将您的信号与minus (-) 一起使用,或者可以查看here,我在其中创建了一个非常基本的局部最小值脚本。
  • 这可能是题外话,对不起,但你的适合似乎一切都不是正确的。你确定你应该使用多项式来拟合吗?三次样条插值不能获得更好的结果吗?
  • 同意@thewaywewalk .... 你为什么还要适合?不合适会比我在发布的图片中看到的要好。无论如何,我相信有一个功能 findpeaks 可能会对您有所帮助。
  • @Werner 谢谢你的回答,我会试试的。
  • @BowHouse 只需使用样条插值而不是多项式,它将解决您的问题。然后你也可以用同样的方式应用 findpeaks。

标签: matlab curve-fitting curve


【解决方案1】:

简单:

% Your polynomial coefficients
c = [-1 4 5 2 6 2 4 5];

% Find real roots of its derivative
R = roots( [numel(c)-1 : -1 : 1] .* c(1:end-1) );
R = R(imag(R)==0);

% Compute and sort function values of these extrema
if ~isempty(R)

    [yExtrema, indsExtrema] = sort(polyval(c, R));
    xExtrema = R(indsExtrema);

    % Extract the two smallest ones
    yMins = yExtrema(1:2);
    xMins = xExtrema(1:2);

else
    yMins = [];
    xMins = [];

end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-01
    • 2020-03-11
    • 1970-01-01
    • 2020-03-19
    • 1970-01-01
    • 2013-10-06
    • 2018-07-26
    相关资源
    最近更新 更多