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.

 採用された回答

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)
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 6 日
%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)
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 6 日
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