Home > m > timetools > statespacefunctions > ltpda_jacobian.m

ltpda_jacobian

PURPOSE ^

subfunction to handle exceptions when calling the jacobian function

SYNOPSIS ^

function dM = ltpda_jacobian(M,var, order)

DESCRIPTION ^

 subfunction to handle exceptions when calling the jacobian function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: subfunction to handle exceptions when calling the jacobian
 function

 CALL: subsys = dM = ltpda_jacobian(M,var, order)

 INPUTS: M - i*j symbollic array
 var - cell array of p strings giving variable names
 order - order of differenciation, 1 for jacobian, 2 for hessian

 OUTPUTS: dM - symbollic or double array of size i*j*p

 ***** THERE ARE NO DEFAULT PARAMETERS *****

 VERSION: $Id: ltpda_jacobian.html,v 1.4 2008/03/31 10:27:36 hewitson Exp $

 HISTORY: 13-02-2008 A Grynagier
 7-02-2008 A Grynagier
 2-02-2008 A Grynagier
  
 To Do : test numerical issues with large number of parameters, as well as
 time for calculations
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dM = ltpda_jacobian(M,var, order)
0002 % subfunction to handle exceptions when calling the jacobian function
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % DESCRIPTION: subfunction to handle exceptions when calling the jacobian
0006 % function
0007 %
0008 % CALL: subsys = dM = ltpda_jacobian(M,var, order)
0009 %
0010 % INPUTS: M - i*j symbollic array
0011 % var - cell array of p strings giving variable names
0012 % order - order of differenciation, 1 for jacobian, 2 for hessian
0013 %
0014 % OUTPUTS: dM - symbollic or double array of size i*j*p
0015 %
0016 % ***** THERE ARE NO DEFAULT PARAMETERS *****
0017 %
0018 % VERSION: $Id: ltpda_jacobian.html,v 1.4 2008/03/31 10:27:36 hewitson Exp $
0019 %
0020 % HISTORY: 13-02-2008 A Grynagier
0021 % 7-02-2008 A Grynagier
0022 % 2-02-2008 A Grynagier
0023 %
0024 % To Do : test numerical issues with large number of parameters, as well as
0025 % time for calculations
0026 %
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 if order==1
0029     if isempty(M)||isempty(var)
0030         dM = zeros(size(M),length(var));
0031     else
0032         reshape( jacobian( M, var ) , [size(M), length(var)] );
0033     end
0034 elseif order ==2
0035     if isempty(M)||isempty(var)
0036         dM = zeros(size(M),length(var),length(var));
0037     else
0038         dM =   reshape( jacobian( M, var ) , [size(M), length(var),  length(var)] );
0039     end
0040 else
0041     display('error because differenctiation was asked with wrong order:')
0042     display(order)
0043     dM = M;
0044 end
0045 end

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003