Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Mahmoud Sayed
Mahmoud Sayed am 8 Mai 2019
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 Kommentare
Mahmoud Sayed
Mahmoud Sayed am 8 Mai 2019
oh, we are working on the same project and we have had this issue for the past couple of days

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 8 Mai 2019
Read about double. Convert your sym to double.
C_n = double(C_n)

Walter Roberson
Walter Roberson am 8 Mai 2019
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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by