How can i get the trigonometric function of cos and sin of a variable

2 views (last 30 days)
Hello everyone, i am creating a program which consists, that you have to insert the value of Theta, alfa, d, and r.
The program can solve multiplication of arrays which the user introduce as a number, or as a variable
With the multiplication of arrays when the user introduce numbers i didnt have problems, but when the user introduces the value of theta, alfa, d and r, in variables i got stucked.
This is what i´v been trying
if Art == 2
fprintf('\n \n')
T1 = input(' Introduce the value of Theta for row 1 = ', 's' )
A1 = input(' Introduce the value of alfa for row 1 = ', 's'')
d1 = input(' Introduce the value of d for row 1 = ', 's' )
r1 = input(' Introduce the value of r for row 1 = ', 's')
M1 = [cos(T1) -sin(T1) 0 d1; cos(A1)*sin(T1) cos(A1)*cos(T1) -sin(A1) -r1*sin(A1); sin(A1)*sin(T1) sin(A1)*cos(T1) cos(A1) r1*cos(A1); 0 0 0 1]
T2 = input(' Introduce the value of Theta for row 2 = ','s')
A2 = input(' Introduce the value of alfa for row 2 = ', 's')
d2 = input(' Introduce the value of d for row 2 = ', 's')
r2 = input(' Introduce the value of r for row 2= ', 's')
M2 = [cos(T2) -sin(T2) 0 d2; cos(A2)*sin(T2) cos(A2)*cos(T2) -sin(A2) -r2*sin(A2); sin(A2)*sin(T2) sin(A2)*cos(T2) cos(A2) r2*cos(A2); 0 0 0 1]
pause(2)
Res = M1*M2
pause(3)
disp(' See ya =)')
break

Answers (1)

David Hill
David Hill on 31 Mar 2020
Why are the users not entering numbers instead of character arrays?
T1 = input('Introduce the value of Theta for row 1 = ');
  7 Comments

Sign in to comment.

Categories

Find more on Discrete Math in Help Center and File Exchange

Products


Release

R2015a

Community Treasure Hunt

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

Start Hunting!