フィルターのクリア

keep getting 1X4 syms as my answer instead of a value

1 回表示 (過去 30 日間)
Mahmoud Sayed
Mahmoud Sayed 2019 年 5 月 8 日
回答済み: Walter Roberson 2019 年 5 月 8 日
A = pi*(0.01)^2;
p = 1/(A*0.4);
mass_shaft = 1;
w = (1E5*2*pi)/60;
rad_shaft = 0.01;
E_s = 2E11;
I_S = pi*(rad_shaft^4)/4;
length_shaft = 0.4;
f = 'cos(x)*cosh(x)-1'; %function
r = [fzero(f,4.0) fzero(f,7.0) fzero(f,10.0) fzero(f,14.0)]; %roots
beta = r./length_shaft;
syms y
double Q
double B
double C_n
Q = (cos(y.*beta) + cosh(y.*beta) - ((cos(length_shaft.*beta) - ...
cosh(length_shaft.*beta))./(sin(length_shaft.*beta) - ...
sinh(beta.*length_shaft))).*(sin(y.*beta) + sinh(y.*beta))).^2;
B = int(Q,y,0,length_shaft);
C_n = (B.*A*p).^(-0.5);
This is my code and whenever I run it, I get 1X4 syms for the values of Q,B and C_n and I get 1X1 syms for y, I want MATLAB to show me their actual values instead of this 1X4 syms ive been trying to figure it out for a while with no luck whatsoever, thanks in advance!!
  3 件のコメント
Mahmoud Sayed
Mahmoud Sayed 2019 年 5 月 8 日
oh, we are working on the same project and we have had this issue for the past couple of days

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2019 年 5 月 8 日
Read about double. Convert your sym to double.
C_n = double(C_n)

Walter Roberson
Walter Roberson 2019 年 5 月 8 日
To have been shown the answer in that form, you would have had to been look at the variables using the Variable Browser.
There is no way to get the Variable Browser to show the content of symbolic variables.
If you had displayed the variables to the command window, you would have seen the content.

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by