clinspace - Linearly spaced vector of circular values (angles). USAGE x = clinspace(n,range) n number of values range optional: 1 for [-pi,pi[ (default) 2 for [0,2pi[ SEE ALSO See also isradians, wrap.
0001 %clinspace - Linearly spaced vector of circular values (angles). 0002 % 0003 % USAGE 0004 % 0005 % x = clinspace(n,range) 0006 % 0007 % n number of values 0008 % range optional: 1 for [-pi,pi[ (default) 0009 % 2 for [0,2pi[ 0010 % 0011 % SEE ALSO 0012 % 0013 % See also isradians, wrap. 0014 % 0015 0016 % Copyright (C) 2013 by Michaƫl Zugaro 0017 % 0018 % This program is free software; you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation; either version 3 of the License, or 0021 % (at your option) any later version. 0022 0023 function x = clinspace(n,range) 0024 0025 % Check number of parameters 0026 if nargin < 1, 0027 error('Incorrect number of parameters (type ''help <a href="matlab:help clinspace">clinspace</a>'' for details).'); 0028 end 0029 0030 if nargin < 2, 0031 range = 1; 0032 end 0033 0034 if ~isiscalar(n), 0035 error('Incorrect number of values (type ''help <a href="matlab:help clinspace">clinspace</a>'' for details).'); 0036 end 0037 0038 % Determine range 0039 if range == 1, 0040 x = linspace(-pi,pi,n+1); 0041 else 0042 x = linspace(0,2*pi,n+1); 0043 end 0044 x(end) = [];