Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Make function injective Date: Sun, 21 Nov 2010 21:43:03 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 21 Message-ID: <icc3p7$kns$1@fred.mathworks.com> References: <icbulh$440$1@news2.rz.uni-karlsruhe.de> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1290375783 21244 172.30.248.35 (21 Nov 2010 21:43:03 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 21 Nov 2010 21:43:03 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:688807 Armin Mueller <arm.in@web.de> wrote in message <icbulh$440$1@news2.rz.uni-karlsruhe.de>... > Dear NG, > > I would like to calculate the inverse function of a (measured) curve > which should be strictly decreasing. However, the data is noisy and not > 100% perfect. > > To fix the curve, I've written some lines of code that drop all points > that are increasing or level. However, I have the dim feeling that the > code could be shorter and more elegant. Any idea how? > ....... - - - - - - - - - - - Why not do a sort with the decreasing option on 'curve'? If its deviation from non-increasing monotonicity is due only to small noise effects, the swapping of 'curve' values due to the sorting would all occur in local regions and the over-all curve's characteristics would be essentially preserved. This way you would not have to drop any points at all. Such a procedure may seem heretical because it violates the sanctity of the curve's ordinate and abscissa value pairings, but that really is no more fundamental a change than the disturbance produced by noise, assuming that the theoretical noise-free curve is indeed monotone. This does not necessarily produce a strictly decreasing result. For that you would have to play further tricks on the curve values. I can think of a few but I'll let you ponder the matter. Another notion would be to apply some sort of smoothing filter to the curve values which would hopefully render it monotone if done properly. The choice of appropriate filter would of course depend on the nature of the noise. Roger Stafford