solve non linear equations with constraint

  • Follow


Hi,

I want to solve a set of non linear equations f[X]= Y
where
Y is a given vector has n dimensions;
X is the vector to be solved, which also has n dimensions;
I would like to add one more constraint on X such that x1+x2+...+Xn=1

I am not sure if fsolve can handle constraint or is there another function that I can utilise? Please advise on this and many thanks in advance.

J
0
Reply Jie 11/16/2010 10:09:05 PM

"Jie " <jz286@cam.ac.uk> wrote in message <ibuve1$7r$1@fred.mathworks.com>...
> Hi,
> 
> I want to solve a set of non linear equations f[X]= Y
> where
> Y is a given vector has n dimensions;
> X is the vector to be solved, which also has n dimensions;
> I would like to add one more constraint on X such that x1+x2+...+Xn=1
> 
> I am not sure if fsolve can handle constraint or is there another function that I can utilise? Please advise on this and many thanks in advance.
=======

Why do you distinguish between this "constraint" and the other non-linear equations. Why not add this equation to your system 

x1+x2+...+Xn=1

making it equation number n+1?
0
Reply Matt 11/16/2010 10:32:04 PM


"Jie " <jz286@cam.ac.uk> wrote in message <ibuve1$7r$1@fred.mathworks.com>...
>
> I am not sure if fsolve can handle constraint or is there another function that I can utilise? Please advise on this and many thanks in advance.

You could also use the constraint equation to eliminate one of the variables, say x(n)

x(n)=1-(x(1)+x(2)+...+x(n-1))

You can then reformulate f[X]=Y in terms of the first n-1 variables x(i) only.

Failing that, there's always fmincon.
0
Reply Matt 11/16/2010 11:20:04 PM

2 Replies
672 Views

(page loaded in 0.027 seconds)

Similiar Articles:













7/21/2012 12:45:49 AM


Reply: