Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Optimization in matlab

Subject: Optimization in matlab

From: zingas

Date: 14 Apr, 2009 07:37:56

Message: 1 of 3

Hi
I want to solve the following optimization problem in matlab
Minimize[(g1c11+g2c21+a1)^2+(g1c12+g2c22+a2)^2+(g1c13+g2c23+a3)^2+
(g1c14+g2c24+a4)^2+(g1C15+g2c25+a5)^2+(g1c16+g2c26+a6)^2]
subject to

g1^2 +g2^2=>0
can anybody tell me which function should i use
Regards

Subject: Optimization in matlab

From: Sander Aerts

Date: 14 Apr, 2009 07:57:02

Message: 2 of 3

Hello,

You can use fsolve to find a solution to function f(x) = 0.. just as you wrote:
> g1^2 +g2^2=>0

use that function to find a value for which you derrivative equals zeros.

Subject: Optimization in matlab

From: Roger Stafford

Date: 14 Apr, 2009 10:55:03

Message: 3 of 3

zingas <shammashahbaz@gmail.com> wrote in message <f2110a9d-0c0c-4939-9aae-4b4dcb282163@e18g2000yqo.googlegroups.com>...
> Hi
> I want to solve the following optimization problem in matlab
> Minimize[(g1c11+g2c21+a1)^2+(g1c12+g2c22+a2)^2+(g1c13+g2c23+a3)^2+
> (g1c14+g2c24+a4)^2+(g1C15+g2c25+a5)^2+(g1c16+g2c26+a6)^2]
> subject to
>
> g1^2 +g2^2=>0
> can anybody tell me which function should i use
> Regards

  Letting c be the 2 x 6 matrix of c_ij values and a be the 1 x 6 row vector of a_i values, this is a problem for matlab's matrix forward division operator ('/'):

 g = -a/c;

It finds least square solutions in cases like this where there are more equations to satisfy than unknowns. You can then evaluate

 sum((g*c+a).^2)

to get the minimum value of the given expression.

  If by "g1^2+g2^2=>0" you mean "g1^2+g2^2 is greater than or equal to zero", and if g1 and g2 are to be real, I don't understand why you regard that as a condition. It is true of all reals.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us