what your feasible set is- clearly enough for me to be able to tell you what to use, so all I can do is point you in the direction of relevant resources. Your background info doesn't describe what you're doing - esp. You can certainly use the MATLAB Engine or MATLAB Compiler to call fmincon from your program, but most likely your software will run a good deal faster (and you can avoid purchasing the MATLAB Compiler) if you can use a little more knowledge about the structure your optimization problem has and call an appropriate algorithm. Most of the time, libraries out there won't try to be a black box magic one-size-fits-all optimization tool like fmincon is- instead they'll require you to provide more detail and make more choices on your own, which is simpler for them and should result in your software being faster. The cost function is the sum-squared distance between corresponding flight waypoints and camera waypoints (ignoring altitude differences). There are no constraints on the camera path, so its segments may be longer or shorter than the flight path segments and it may have sharp turns. The turn radius is also constrained by an upper bound. The flight path segments will all be the same length since the UAV flies at a constant speed. The waypoints between the two paths correspond temporally, so the camera gimbal will be pointed at the i-th camera waypoint when the UAV arrives at the i-th flight path waypoint. We're trying to optimize a waypoint flight path of a UAV to follow a given waypoint camera path along the ground as closely as possible. If neither of the above are an option, what optimization libraries are available that would be fairly easy to switch to from fmincon? Is there a good way to compile the fmincon function into a library that we can use in C ? Or, is there already a library available somewhere that implements fmincon? We need to port that part of the project to C in order to integrate it with other parts of the project. %This is an alternative to the inline definition of y_mod() above.We're currently using Matlab's fmincon function to do non-linear optimization for a project I'm working on. = fmincon(objective,p_initial,options) įprintf('RMS Error=%.3f, intercept=%.3f, slope=%.4f\n'. %If you use y_mod(), then you must define it somewhere X = Y = Global x %need this if define y_mod() separately, and in that case y_mod() must declare x global %Reply to stack exchange question on parameter fitting This version uses the multi-line declaration of y_mod(). It has many commented lines because it includes alternate ways to fit the data: an inline declaration of y_mod(), or a multi-line declaration of y_mod(), or no y_mod() at all. RMS Error=0.374, intercept=4.208, slope=0.0388Īnd here is code for the above. Here is the output from a script that has the function declaration: > modelFitExample2a How can I multiply p(2) with x? Where x is not optimized, because the values are given. However, it does not work if I use the following code. If I specify my function as follows then it works. The model is: y = alpha beta'*x.įor minimization, I am using Matlab's fmincon function and am struggling with multiplying my parameter p(2) by x. I have a simple model where I want to minimize the RMSE between my dependent variable y and my model values.
0 Comments
Leave a Reply. |