You're very close. You need to encapsulate the multiple variables in a cell array, not a numeric array. Replace the []
to {}
. Also, make sure you assign the result of your subs
call back to something... so in your case, use M05
again:
>> M05 = subs(M05,{t1,t2,t3,d},{degtorad(45),degtorad(-75),degtorad(130),70});
M05 =
[ (2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4))/2 + (2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4))/2, (2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4))/2 - (2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4))/2, -2^(1/2)/2, 15*2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4) - 15*2^(1/2)*(2^(1/2)/4 - 6^(1/2)/4) + 15*2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4)]
[ (2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4))/2 + (2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4))/2, (2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4))/2 - (2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4))/2, 2^(1/2)/2, 15*2^(1/2)*cos((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4) - 15*2^(1/2)*(2^(1/2)/4 - 6^(1/2)/4) + 15*2^(1/2)*sin((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4)]
[ sin((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4) - cos((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4), - cos((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4) - sin((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4), 0, (15*2^(1/2))/2 - 30*cos((5*pi)/18)*(2^(1/2)/4 + 6^(1/2)/4) + (15*6^(1/2))/2 + 30*sin((5*pi)/18)*(2^(1/2)/4 - 6^(1/2)/4) + 70]
[ 0, 0, 0, 1]
However, this is still in symbolic format. If you want the numeric result, simply cast M05
to double
:
>> M05 = subs(M05,{t1 t2 t3 d},{degtorad(45) degtorad(-75) degtorad(130) 70});
>> M05 = double(M05)
M05 =
0.4056 -0.5792 -0.7071 17.6578
0.4056 -0.5792 0.7071 17.6578
-0.8192 -0.5736 0 74.4032
0 0 0 1.0000
Small note (thanks to horchler)
Since MATLAB R2012a+, you don't need to use {}
to encapsulate the variables. You can just use []
as normal as this is more in tune with how MuPAD's version of subs
works.