How to solve (minimize) with restrictions a system of three equations with three unknown variables

7 views (last 30 days)
I have a system of three equations that I use to determine coordinates after a movement towards a point through the straightest path, i.e. a distance reduction equation and two vector alignment equations. I would like to keep moving towards my heading at the fastest way possible, but avoiding collision with an obstacle, I need therefore to minimize the systems solution while applying up to 26 restrictions. Which processes are at my disposal to do so?
The input for my function containing the three equations is as varied as data coming from various vectors. Here is the system:
function qmv=quickmove(ss,d1,d2,d3,hx,hy,hz)
global a b c ;
qmv(1)=sqrt((d1-hx).^2+(d2-hy).^2+(d3-hz).^2)-sqrt((a-hx).^2+(b-hy).^2+(c-hz).^2)-ss==0;
qmv(2)=sqrt((d1-hx)^2+(d2-hy)^2)*abs(a-hx)-sqrt((a-d1)^2+(b-hy)^2)*abs(d1-hx)==0;
qmv(3)=sqrt((d3-hz)^2+(d2-hy)^2)*abs(b-hy)-sqrt((c-hz)^2+(b-hy)^2)*abs(d2-hy)==0;
end
Is this correct? d1,d2,d3 are the starting coordinates of my object and hx,hy,hz are the final destination coordinates and ss is the speed of my object.
Thank you for any help you can provide.

Answers (2)

Orion
Orion on 13 Oct 2014
Hi,
if you have the optimization toolbox, you can use fmincon ( Find minimum of constrained nonlinear multivariable function )
  2 Comments
David
David on 13 Oct 2014
fmincon shoes an example for f(x) but could I do the same for f(x,y,z)? And also, I require the input of parameters that will be determined during the programm and cannot input them beforehand. How do I do this? Or is it even possible?
Alan Weiss
Alan Weiss on 13 Oct 2014
The x in fmincon is a vector, so f(x) could equal f([x,y,z]), if you see what I mean.
As long as fmincon has the values it needs at the time it needs them, there is no problem. But I do not quite know how you are going to ensure that it does. I think you need to parameterize your problem, have fmincon adjust the parameters to ensure both feasibility (no crashes) and minimum time.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.


Orion
Orion on 13 Oct 2014
Actually,
all your variables ( x, y and z ) are defined in one vector when you use fmincon.
meaning :
x -> x(1)
y -> x(2)
z -> x(3)
so if you have n unknown, you'll have a n*1 vector x
you need to "recode" :
sqrt((d1-hx).^2+(d2-hy).^2+(d3-hz).^2).....
as
sqrt((d1-x(1)).^2+(d2-x(2)).^2+(d3-x(3)).^2)....
and so on.
and for your input parameters_, it should work with global variables, just don't use a,b,c, but more complicated names (like MyInputParam_a) to avoid potential conflict.

Categories

Find more on Operators and Elementary Operations 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!