problem with the symbolic calculation

Hello! i have a problem: I have a peace of code:
Q1=30;
Q1rad=(pi/180)*Q1;
S1= sym('sin(Q1rad)');
double(S1)
and it doesn.t work because I translate variable to the 'sin(...)' how to make it works? what is the way to calculate expressions with "sin(Q1rad)" and in the end substitute the Q1rad, and calculate the final value of the expression?
best regards! Dmytro.

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 6 de Nov. de 2013
I translate variable to the 'sin(...)' , what doesthat mean?
If you want double(S1), just write:
sin(Q1rad)

5 comentarios

Dk
Dk el 6 de Nov. de 2013
Editada: Azzi Abdelmalek el 6 de Nov. de 2013
for example, why I can not compute double(C) here?
syms A B C S1 S2 S3;
A=[S1 S2 1;2 3 S2; 3 S1 S3];
B=[S3 S1 1;3 2 S1; 2 S3 S2];
C=A*B;
Q1=30;Q2=20;Q3=10;
Q1rad=(pi/180)*Q1;
Q2rad=(pi/180)*Q2;
Q3rad=(pi/180)*Q3;
S1=sin(Q1rad)
S2=sin(Q2rad)
S3=sin(Q3rad)
double(C)
%Do not put the cart before the horse
syms A B C S1 S2 S3;
Q1=30;Q2=20;Q3=10;
Q1rad=(pi/180)*Q1;
Q2rad=(pi/180)*Q2;
Q3rad=(pi/180)*Q3;
S1=sin(Q1rad)
S2=sin(Q2rad)
S3=sin(Q3rad)
A=[S1 S2 1;2 3 S2; 3 S1 S3];
B=[S3 S1 1;3 2 S1; 2 S3 S2];
C=A*B;
double(C)
Dk
Dk el 6 de Nov. de 2013
Editada: Azzi Abdelmalek el 6 de Nov. de 2013
:DD sorry maybe my questions are a little stupid, but why I can not compute here double(S1) ? or I should change my approach?
Q1=30;
Q1rad=(pi/180)*Q1;
S1= sym('sin(Q1rad)');
double(S1)
Q1=30;
Q1rad=(pi/180)*Q1;
S1= sym('sin(Q1rad)')
double(subs(S1))
Dk
Dk el 6 de Nov. de 2013
YES) Thank you!

Iniciar sesión para comentar.

Más respuestas (1)

Andrei Bobrov
Andrei Bobrov el 6 de Nov. de 2013
q = [30;20;10];
S = sind(q);
A = [S(1) S(2) 1;2 3 S(2);3 S(1) S(3)];
B=[S(3) S(1) 1;3 2 S(1); 2 S(3) S(2)];
C = A*B;

Preguntada:

Dk
el 6 de Nov. de 2013

Comentada:

Dk
el 6 de Nov. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by