How do I constrain a custom model to go through a certain point at a certain slope?
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Veda Upadhye
on 8 Aug 2017
Edited: Veda Upadhye
on 8 Aug 2017
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
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!