%% Bassam Jalgha Nov 2010
% This function subs the symbolic character in a symbolic expression with
% double valued numbers, example:
% out=SYM_sub(T,teta1,pi,teta2,pi/2,teta3,pi/4,L1,1,L2,2);
% subs pi in place of teta1 in expression T
% subs pi/2 in place of teta2 in expression T etc ...
function Tr=SYM_sub(T,varargin)
optargin = size(varargin,2);
if(mod(optargin,2)~=0) % if odd
error('DH_sub should take even number of optional arguments')
end
Tr=T;
for i=1:2:optargin
Tr=subs(Tr,varargin{i},varargin{i+1},0); %the zero is because of a bug, check the documentation on the sub fct
end