How can I optimize coefficients of a polynomial using fmincon?

10 views (last 30 days)
Bryant Springle on 28 Apr 2021
Commented: Bruno Luong on 28 Apr 2021
I have 3 equations that represents a curve in 3D space. These equations are
X(t) = at^5 + bt^4 + ct^3 + dt^2 + et + f
Y(t) = at^5 + bt^4 + ct^3 + dt^2 + et + f
Z(t) = at^5 + bt^4 + ct^3 + dt^2 + et + f
I have certain constraints for this problem. But figuring out how to write this into a function in Matlab is difficult. I don’t know what to do with the t^n. Since the parameters that are changing are the coefficients, how do I write this into Matlab? My cost function is J= sqrt( dxdt^2 + dydt^2 + dzdt^2) (Or at least, this is what I have been interpreting it as. The overall goal is to minimize the length of the cost function )
Bryant Springle on 28 Apr 2021
Sorry, I should have mentioned that teh coefficients are different for each equation. I just wanted to show that each equation is modeled by a quintic polynomial. And after viewing another answer, I am now realizing that the cost function is as integral

Bruno Luong on 28 Apr 2021
Edited: Bruno Luong on 28 Apr 2021
"The overall goal is to minimize the length of the cost function "
The overall length is
L = integral sqrt(dx/dt^2+dy/dt^2+dy/dt^2)(t) dt
t is then a integration variable to compute L that you want ti minimize.
You should program the code to compute L from coefficients by integrating on t, over whatever the interval that defines your curve.
Bruno Luong on 28 Apr 2021
"Would this be a valid constraint?"
Yes.
You can use Aeq/beq arguments as well since value constraints us a linear constraint wrt coefficients.

R2020b

Community Treasure Hunt

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

Start Hunting!