Code covered by the BSD License  

Highlights from
scm

from scm by Reinaldo Mauricio do Nascimento
Robotic Manipulator Kinematics

qrand (n,q)
function d = qrand (n,q)
%QRAND(Manipulator, Option(numeric joint variables))
%Creates formatted numeric vectors of joint variables
%q = qrand(manipulator) or q = qrand(manipulator, [q1 ... qn]) 

%July ~ December 2005, by Reinaldo M. do Nascimento

if isa(n,'struct'),robot=n;n=size(n.jointParameters,1);else,error('Incompatible type of data');end
if nargin==1
         d=struct('robot',robot,'q',mod(random('exp',1/(.25*n),1,n),2*pi));
elseif nargin==2
             if length(q)==n
                 d=struct('robot',robot,'q',q);
             else
                 disp('The number of variables is different. It must be:')
                 disp(n)
             end
end

Contact us at files@mathworks.com