derives the stability function for the Runge-Kutta method prescribed by b,c,A Input arguments: b, column vector holding the Runge-Kutta weights c, column vector holding the Runge-Kutta nodes A, matrix holding the coefficients a(i,j) which prescribe the method. Output arguments: R stability function
0001 function [ R ] = RK_stab_fun( b,c,A ) 0002 % derives the stability function for the Runge-Kutta method prescribed by b,c,A 0003 % Input arguments: 0004 % b, column vector holding the Runge-Kutta weights 0005 % c, column vector holding the Runge-Kutta nodes 0006 % A, matrix holding the coefficients a(i,j) which prescribe the method. 0007 % Output arguments: 0008 % R stability function 0009 0010 % first check user inputs 0011 [Arows,Acols]=size(A); 0012 [brows,bcols]=size(b); 0013 [crows,ccols]=size(c); 0014 if Arows~=Acols; 0015 error('matrix must be a square matrix'); 0016 elseif bcols~=1 || ccols~=1; 0017 error('input must be column vectors'); 0018 elseif brows~=Arows || crows~=Arows; 0019 error('dimensions do not match'); 0020 end 0021 0022 syms z % create symbolic variable 0023 R=1+z*b'*inv(eye(Acols)-z*A)*ones(Acols,1); % construct stability function 0024 end 0025