## Changing varibles in a Matrix to Values

### Sharyn Fallick (view profile)

on 2 Mar 2015
Latest activity Answered by Christopher Creutzig

### Christopher Creutzig (view profile)

on 3 Dec 2018
below is the problem I am trying to solve in MatLab. Everything works for computation of these matrix, but once I try to replace the variables with numbers I am receiving errors, or the answers are still in fraction form and pi isn't replaces by the number. Instead it still says cos(2*pi) for example. I would appreciate any help with this. Thanks for your time
syms r E G b h t A Ay Iz Iy alpha theta
LambdaQBt=[cos(alpha),sin(alpha),0;-sin(alpha),cos(alpha),0;0,0,1]
LambdaQB=transpose(LambdaQBt)
HQB=[1,0,0;0,1,0;-r*(1-cos(alpha)),r*sin(alpha),1]
HQBt=transpose(HQB)
TQB=(LambdaQBt*HQB)
fuq=[1/(E*A),0,0;0,1/(G*Ay),0;0,0,1/(E*Iz)]
TQBt=(HQBt*LambdaQB)
Product=(TQBt*fuq*TQB)
fBA=int(Product,alpha,0,theta)
r=3 E=200*10^9 G=77*10^9 b=.1 h=.0866 t=.01 Ay=.0049 Iz=(t*(b^3))/12 Iy=0 A=3*b*t
F=[10000;-5000;10000]
vB=fBA*F

Sharyn Fallick

### Sharyn Fallick (view profile)

on 2 Mar 2015
Also for this problem theta is equal to (4*pi)/9
Stephen Cobeldick

### Stephen Cobeldick (view profile)

on 16 Aug 2018
If the symbolic expression does not contain any symbolic variables without values, then use double to convert a symbolic expression to a numeric value:
double(...)
Note that vB still depends on alpha, so this will not work for the above question, but it might be useful for others who find this thread.
Steven Lord

### Steven Lord (view profile)

on 16 Aug 2018
To extend Stephen's answer, if the symbolic expression DOES contain any symbolic variables without values you can use the vpa function to approximate the numeric parts.
syms x
oneThird = sym(1)/3;
y = oneThird*x + x^2
vpa(y)

### Tiasa Ghosh (view profile)

on 16 Aug 2018

I guess the answer vB is still a symbolic expression is due to the fact that you have assigned numerical values to r,E,G,b and so on, after the fBA has already been evaluated as a symbolic expression. So in the last line when you compute fBa*F , the answer is obviously a symbolic expression.