How can I optimize coefficients of a polynomial using fmincon?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 )
2 comentarios
Matt J
el 28 de Abr. de 2021
These equations are...
As you've written it, the same coefficients are used for X,Y, and Z meaning your curve has to be a straight line.
My cost function is J= sqrt( dxdt^2 + dydt^2 + dzdt^2)
This is not a scalar-valued cost function. Did you really mean,
J= sum( dxdt^2 + dydt^2 + dzdt^2)^2
Respuestas (1)
Bruno Luong
el 28 de Abr. de 2021
Editada: Bruno Luong
el 28 de Abr. de 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.
2 comentarios
Bruno Luong
el 28 de Abr. de 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.
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!