Path: news.mathworks.com!not-for-mail
From: "stephen " <sca2c@virginia.edu>
Newsgroups: comp.soft-sys.matlab
Subject: long summation function for fmincon
Date: Wed, 8 Dec 2010 00:40:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <idmk5k$5vv$1@fred.mathworks.com>
Reply-To: "stephen " <sca2c@virginia.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1291768820 6143 172.30.248.37 (8 Dec 2010 00:40:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 8 Dec 2010 00:40:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1678992
Xref: news.mathworks.com comp.soft-sys.matlab:693450

I have a very long function I want to use in fmincon.  This is my first post so I don't know the best way to state the function but I will attempt it like this:

f = sum (from 1 to n) sum (1 to n) x(i)*x(j) + sum (1 to n) x(i)
n = 120

so there are 14400 terms

Is there an easier way than hard coding all the terms so it will go into fmincon?

Also, at some point I will want to add coefficients to these terms from a 120x120 matrix.  How can I add that to the program?