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

real_to_pos

PURPOSE ^

REAL_TO_POS Maps reals to positive numbers.

SYNOPSIS ^

function s = real_to_pos(t)

DESCRIPTION ^

REAL_TO_POS Maps reals to positive numbers.

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

 See also POS_TO_REAL.

 created by Benedikt Rudolph
 DATE: 20-Aug-2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

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