Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Mahmoud Sayed
Mahmoud Sayed el 8 de Mayo de 2019
Respondida: Walter Roberson el 8 de Mayo de 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 comentarios
Mahmoud Sayed
Mahmoud Sayed el 8 de Mayo de 2019
oh, we are working on the same project and we have had this issue for the past couple of days

Iniciar sesión para comentar.

Respuestas (2)

KSSV
KSSV el 8 de Mayo de 2019
Read about double. Convert your sym to double.
C_n = double(C_n)

Walter Roberson
Walter Roberson el 8 de Mayo de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by