Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: How to get max value of a function subject some constraints in Date: Mon, 4 May 2009 22:56:02 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 15 Message-ID: <gtnrq2$a1v$1@fred.mathworks.com> References: <gsqdk1$f0e$1@fred.mathworks.com> <30651405.54061.1241467743222.JavaMail.jakarta@nitrogen.mathforum.org> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-05-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1241477762 10303 172.30.248.35 (4 May 2009 22:56:02 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 4 May 2009 22:56:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:537400 hhwolf76 <james.zhou76@gmail.com> wrote in message <30651405.54061.1241467743222.JavaMail.jakarta@nitrogen.mathforum.org>... > Thanks for answering my question. > Here is the extension of my question. The constraint is still (theta_N-theta_0)'*(PN^-1)*(theta_N-theta_0)<=alpha > For specific T and t, I can solve the theta_N and corresponding Y by using your solution. > But if T and t keep changing, how can I get the max value of the sum of |Y1+Y2+...+Yn| and corresponding theta_N? n could be 24*3600. There are lots of data here. > > First solution jumping to my head is to solve the every single theta_N and calculate corresponding |Y1+Y2+...+Yn|, comparing them and find the max one. But it need a lot of calculation. Is there some simple solution for this? Thank you very much! ---------- It is important to distinguish between maximizing |Y1+Y2+...+Yn| and maximizing |Y1|+|Y2|+|Y3|+...+|Yn|, the latter of which you mentioned in your first query in this thread. The solution for the first of these can well make some of the Y's negative in reaching its optimum solution, which would influence the selection of that optimum, whereas negative values for some of the Y's don't matter in the second summation. To maximize |Y1+Y2+...+Yn| all you need to do is add up all the R's (using my notation for R = [T^2;T;1;t]), to get a new R and then apply the most recent eigenvector method I mentioned to that R to solve the problem. (Presumably your PN remains the same for all the Y's.) I don't know how to maximize |Y1|+|Y2|+|Y3|+...+|Yn| which is an L1 metric problem. One could maximize Y1^2+Y2^2+Y3^2+...+Yn^2, which is an L2 problem involving a different method of calculating the final R. Roger Stafford