MATLAB Answers

how can i assign values to symbolic matrix?

28 views (last 30 days)
Najmeh Eskandari
Najmeh Eskandari on 22 Jun 2018
Answered: Walter Roberson on 22 Jun 2018
hi. I have the matrix B in symbolic form and I want to calculate it for different values and assign different symbols to it? what should I do?
>> syms theta_i Alpha_i a_i d_i
>> B =[cos(theta_i) -sin(theta_i)*cos(Alpha_i) sin(theta_i)*sin(Alpha_i) a_i*cos(theta_i);sin(theta_i) cos(theta_i)*cos(Alpha_i) -cos(theta_i)*sin(Alpha_i) a_i*sin(theta_i); 0 sin(Alpha_i) cos(Alpha_i) d_i;0 0 0 1];
there are 6 different set of values:
(d_1=d_1,Alph_1=pi/2 , a_1=0,theta_1=theta_1)
(d_2 , Alpha_2=0, a_2=a_2 ,theta_2)

Answers (1)

Walter Roberson
Walter Roberson on 22 Jun 2018
B1 = subs(B, {d_i, Alpha_i, a_i, theta_i}, {d_1, sym(pi)/2, 0, theta_1})
B2 = subs(B, {d_i, Alpha_i, a_i, theta_i}, {d_2, 0, a_2, theta_2})

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by