Home > matlab > acado > packages > +acado > @DifferentialEquation > add.m

add

PURPOSE ^

Add an ordinary differential equation or differential algebraic equation

SYNOPSIS ^

function add(obj, varargin)

DESCRIPTION ^

Add an ordinary differential equation or differential algebraic equation
in symbolic syntax.

  Usage:
    >> DifferentialEquation.add(expression)

  Parameters:
    expression  expression

  Example:
    >> f.add(-dot(x) -x*x + p + u*u + w); or f.add(dot(x) == -x*x + p + u*u + w);
    >> f.add(0 ==  z + exp(z) - 1.0 + x);
    >> f.add(dot(x) = sin(p)*cos(pi) + x);


  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: 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function add(obj, varargin)
0002 %Add an ordinary differential equation or differential algebraic equation
0003 %in symbolic syntax.
0004 %
0005 %  Usage:
0006 %    >> DifferentialEquation.add(expression)
0007 %
0008 %  Parameters:
0009 %    expression  expression
0010 %
0011 %  Example:
0012 %    >> f.add(-dot(x) -x*x + p + u*u + w); or f.add(dot(x) == -x*x + p + u*u + w);
0013 %    >> f.add(0 ==  z + exp(z) - 1.0 + x);
0014 %    >> f.add(dot(x) = sin(p)*cos(pi) + x);
0015 %
0016 %
0017 %  Licence:
0018 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0019 %
0020 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0021 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0022 %    Developed within the Optimization in Engineering Center (OPTEC) under
0023 %    supervision of Moritz Diehl. All rights reserved.
0024 %
0025 %    ACADO Toolkit is free software; you can redistribute it and/or
0026 %    modify it under the terms of the GNU Lesser General Public
0027 %    License as published by the Free Software Foundation; either
0028 %    version 3 of the License, or (at your option) any later version.
0029 %
0030 %    ACADO Toolkit is distributed in the hope that it will be useful,
0031 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0032 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0033 %    Lesser General Public License for more details.
0034 %
0035 %    You should have received a copy of the GNU Lesser General Public
0036 %    License along with ACADO Toolkit; if not, write to the Free Software
0037 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0038 %
0039 %    Author: David Ariens
0040 %    Date: 2010
0041 %
0042 
0043 if (~isempty(obj.matlabODE_fcnHandle) || ~isempty(obj.matlabDAE_fcnHandle) || ~isempty(obj.cfunction_file))
0044    error('Only _one_ Matlab DAE or ODE can be linked.');
0045 end
0046 
0047     if (isa(varargin{1}, 'acado.Expression'))
0048 
0049         obj.differentialList{end+1} = varargin{1};
0050 
0051     else
0052         error('ERROR: Invalid DifferentialEquation.add call. <a href="matlab: help acado.DifferentialEquation.add">help acado.DifferentialEquation.add</a>'); 
0053 
0054     end
0055     
0056     
0057 
0058 end

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