Home > mex > check2.m

check2

PURPOSE ^

CHECK2 script to compare M-file and MEX-file versions of RNE

SYNOPSIS ^

function check2(robot, n, args)

DESCRIPTION ^

CHECK2 script to compare M-file and MEX-file versions of RNE

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %CHECK2 script to compare M-file and MEX-file versions of RNE
0002 
0003 function check2(robot, n, args)
0004     robot = nofriction(robot, 'coulomb');
0005 
0006     % create random points in state space
0007     q = rand(n, 6);
0008     qd = rand(n, 6);
0009     qdd = rand(n, 6);
0010 
0011     % test M-file
0012     tic;
0013     tau = rne(robot, q, qd, qdd, args{:});
0014     t = toc;
0015 
0016     % test MEX-file
0017     tic;
0018     tau_f = frne(robot, q, qd, qdd, args{:});
0019     t_f = toc;
0020 
0021     % print comparative results
0022     fprintf('Speedup is %10.0f, worst case error is %f\n', ...
0023         t/t_f, max(max(abs(tau-tau_f))));

Generated on Sun 15-Feb-2009 18:09:29 by m2html © 2003