当仅知道y峰的x值时,将曲线拟合到点 [英] Fit curve to points when only x-value of y-peak is known

查看:72
本文介绍了当仅知道y峰的x值时,将曲线拟合到点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些需要拟合曲线的怪异条件.我曾尝试在其他地方查找它,但甚至不确定我使用的是正确的术语.任何帮助都将不胜感激.

I've got a bit of a weird set of conditions I need to fit a curve to. I've tried looking it up elsewhere but I'm not even sure I'm using the right lingo. Any help is much appreciated.

我正在尝试将多项式曲线拟合为一组四个点.已知三点,但第四点有些棘手.我有最大y值的x值,但我不知道最大y值是多少.例如,假设在(0,0),(1,1)和(4,0)处有已知点. y的最大值为x = 3,因此第四个点为(3,ymax).我将如何拟合这些条件的四阶多项式曲线?预先感谢.

I'm trying to fit a polynomial curve to a set of four points. Three of the points are known, but the fourth one is a little tricky. I have the x value for the maximum y value, but I don't know what the maximum y value is. For example, let's say there are known points at (0,0), (1,1), and (4,0). The maximum y value is at x=3 so the fourth point is (3, ymax). How would I fit a 4th order polynomial curve to those conditions? Thanks in advance.

推荐答案

实际上是可能的,因为您要求x = 3处的y值应为最大值.因此,一个4阶多项式有5个系数待确定,您具有以下等式:

Actually it is possible since you require the y value at x=3 should be maximum. So, a degree 4 polynomial has 5 coefficients to be determined and you have the following equations:

y(0)= 0
y(1)= 1
y(4)= 0
dy/dx(3)= 0(x = 3处的一阶导数应为0)
d2y/dx2(3)< 0(x = 3处的二阶导数应为负)

y(0) = 0
y(1) = 1
y(4) = 0
dy/dx(3) = 0 (first derivative at x=3 should be 0)
d2y/dx2(3) < 0 (2nd derivative at x=3 should be negative)

因此,在x = 3处为d2y/dx2选择任何负值,并求解5个线性方程,您将获得1度4多项式.请注意,以这种方式获得的x = 3处的y值仅是局部最大值,而不是全局最大值.

So, pick any negative value for d2y/dx2 at x=3 and solve the 5 linear equations and you will get one degree 4 polynomial. Note that the y value at x=3 obtained this way is only a local maximum, not a global maximum.

这篇关于当仅知道y峰的x值时,将曲线拟合到点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆