Home > code > util > parameter_transformation > transformations > pos_to_real.m

pos_to_real

PURPOSE ^

POS_TO_REAL Maps positive numbers to reals.

SYNOPSIS ^

function t = pos_to_real(s)

DESCRIPTION ^

POS_TO_REAL Maps positive numbers to reals.

  t = pos_to_real(s) maps the positive number s to the real number t.
    Works as the inverse function of real_to_pos, hence
    pos_to_real(real_to_pos(x)) is nearly equal to x.

 See also REAL_TO_POS.

 created by Benedikt Rudolph
 DATE: 20-Aug-2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t = pos_to_real(s)
0002 %POS_TO_REAL Maps positive numbers to reals.
0003 %
0004 %  t = pos_to_real(s) maps the positive number s to the real number t.
0005 %    Works as the inverse function of real_to_pos, hence
0006 %    pos_to_real(real_to_pos(x)) is nearly equal to x.
0007 %
0008 % See also REAL_TO_POS.
0009 %
0010 % created by Benedikt Rudolph
0011 % DATE: 20-Aug-2012
0012 
0013   t = zeros(size(s));
0014   idx = (s>=1);
0015   t(idx) = s(idx)-1;
0016   t(~idx) = 1-1./s(~idx);
0017 end

Generated on Mon 29-Apr-2013 19:29:13 by m2html © 2005