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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by