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.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 6일

0 개 추천

I translate variable to the 'sin(...)' , what doesthat mean?
If you want double(S1), just write:
sin(Q1rad)

댓글 수: 5

Dk
Dk 2013년 11월 6일
편집: Azzi Abdelmalek 2013년 11월 6일
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 2013년 11월 6일
편집: Azzi Abdelmalek 2013년 11월 6일
: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 2013년 11월 6일
YES) Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 11월 6일

0 개 추천

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;

질문:

Dk
2013년 11월 6일

댓글:

Dk
2013년 11월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by