Uses the boundary locus method to identify the boundary of the linear stability region of the general multistep method described by the polynomials rho and sigma. Input arguments: rho, sigma, column vectors whose elements are the coefficients of the defining polynomials in descending powers. n, number of plot points Output arguments: z, points on paramterised curve
0001 function [ z ] = boundary_locus( rho,sigma,n ) 0002 % Uses the boundary locus method to identify the boundary 0003 % of the linear stability region of the general multistep method 0004 % described by the polynomials rho and sigma. 0005 % Input arguments: 0006 % rho, sigma, column vectors whose elements are the coefficients 0007 % of the defining polynomials in descending powers. 0008 % n, number of plot points 0009 % Output arguments: 0010 % z, points on paramterised curve 0011 0012 % check user inputs 0013 [a,b]=size(rho); 0014 [c,d]=size(sigma); 0015 if b~=1 || d~=1; 0016 error('inputs must be column vectors'); 0017 elseif a~=c; 0018 error('inputs must be the same length'); 0019 end 0020 0021 x=linspace(0,2*pi,n); % initialize range of the parameter 0022 0023 num = polyval(rho,exp(1i*x)); 0024 denom = polyval(sigma, exp(1i*x)); 0025 z = num./denom; 0026 end 0027 0028 0029