How do I constrain a custom model to go through a certain point at a certain slope?

1 次查看(过去 30 天)
I currently have two functions that I am trying to combine into a piecewise continuous function. The left side fits the data very well, so I want to have the right side's fit begin where the left side leaves off. For simplicity sake, let's call this point x. This means I want right_f(x) = left_f(x) and right_f'(x) = left_f'(x).
How do I go about doing this? For what it's worth, the function I'm fitting is of the form f(x)=A/(1+exp(-B*(x-C)))+D on both the left and right sides.

回答(1 个)

Veda Upadhye
Veda Upadhye 2017-8-8
编辑:Veda Upadhye 2017-8-8
Hi Quinn,
There is a MathWorks blog post which talks about a few ways to constrain a polynomial to go through certain points. It includes some example code and you may customize your code accordingly.
Here is the link to it:
https://blogs.mathworks.com/pick/2015/12/11/polynomial-fit-passing-through-specified-points/
Hope this helps,
Veda

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by