```Path: news.mathworks.com!not-for-mail
From: "Petros " <p3tris@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Optimization using Heaviside function
Date: Sun, 13 Jun 2010 18:43:03 +0000 (UTC)
Organization: NTUA
Lines: 11
Message-ID: <hv38rn\$sfv\$1@fred.mathworks.com>
References: <hv34vv\$91u\$1@fred.mathworks.com> <hv37q2\$psk\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1276454583 29183 172.30.248.38 (13 Jun 2010 18:43:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 13 Jun 2010 18:43:03 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:644595

Thanks for replying. Really the function is not that one. The real function is a 2-variable function with quadratic parts and heaviside functions. I just wanted to start with something simpler. I cannot avoid the heaviside functions unfortunately, because they represent decisions made by a controller. So, the functions are

P={a if 0<x1<5; b if 5<x1} and
Q={c if 0<x2<19; d if 19<x2} and
L=(Q-P-Q0)*FINE(Q-P-Q0) where
FINE(Q-P-Q0)={e if 0<(Q-P-Q0)<100; f if 100<(Q-P-Q0)<200}

And I try to maximize (Q-P-L) or minimize -(Q-P-L).
It's not something I can do by hand for repeated problems and I thought matlab could help me out.

Thanks again.
```