필터 지우기
필터 지우기

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 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