Home > matlab > acado > packages > +acado > @Power > Power.m

Power

PURPOSE ^

Power of expressions.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

Power of expressions.

  Usage:
    >> Power(obj1, obj2);
    >> obj1^obj2;

  Parameters:
    obj1         [Expression]
    obj2       [Expression]

  Licence:
    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)

    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
    Developed within the Optimization in Engineering Center (OPTEC) under
    supervision of Moritz Diehl. All rights reserved.

    ACADO Toolkit is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 3 of the License, or (at your option) any later version.

    ACADO Toolkit is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with ACADO Toolkit; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

    Author: David Ariens
    Date: 2009

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %Power of expressions.
0002 %
0003 %  Usage:
0004 %    >> Power(obj1, obj2);
0005 %    >> obj1^obj2;
0006 %
0007 %  Parameters:
0008 %    obj1         [Expression]
0009 %    obj2       [Expression]
0010 %
0011 %  Licence:
0012 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0013 %
0014 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0015 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0016 %    Developed within the Optimization in Engineering Center (OPTEC) under
0017 %    supervision of Moritz Diehl. All rights reserved.
0018 %
0019 %    ACADO Toolkit is free software; you can redistribute it and/or
0020 %    modify it under the terms of the GNU Lesser General Public
0021 %    License as published by the Free Software Foundation; either
0022 %    version 3 of the License, or (at your option) any later version.
0023 %
0024 %    ACADO Toolkit is distributed in the hope that it will be useful,
0025 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0027 %    Lesser General Public License for more details.
0028 %
0029 %    You should have received a copy of the GNU Lesser General Public
0030 %    License along with ACADO Toolkit; if not, write to the Free Software
0031 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0032 %
0033 %    Author: David Ariens
0034 %    Date: 2009
0035 %
0036 classdef Power < acado.BinaryOperator
0037     properties(SetAccess='private')
0038 
0039     end
0040     
0041     methods
0042         function obj = Power(obj1, obj2)
0043             if (isa(obj1, 'numeric'))
0044                 obj1 = acado.DoubleConstant(obj1);
0045             elseif (isa(obj2, 'numeric'))
0046                 obj2 = acado.DoubleConstant(obj2);
0047             end
0048             
0049             obj.obj1 = obj1;
0050             obj.obj2 = obj2;
0051         end
0052         
0053         function s = toString(obj)
0054             s = sprintf('pow(%s,%s)', obj.obj1.toString, obj.obj2.toString); 
0055         end
0056     end
0057     
0058 end
0059

www.acadotoolkit.org/matlab
Generated on Tue 01-Jun-2010 20:14:12 by m2html © 2005