Home > OS >  How to display a numeric answer instead of a calculation?
How to display a numeric answer instead of a calculation?

Time:02-18

I keep getting answers as a calculation instead of numeric answer, like the following:

(291*pi*((30*3^(1/2))/13 - 1)*((13*3^(1/2)*((30*3^(1/2))/13 - 2))/400   197/200))/13

I would rather like to have a numerical answer, i am no MATLAB expert can someone please help me? Following is the code that leads to this. (All variables except m has been defined earlier)

syms m ;

eqn=(d m* d* ((sqrt(3))/2)<f); 

M = solve(eqn,m);     
disp (M)


r= (b/2) d*((M-1)*sqrt(3) 2)/(4);

L=2* pi* M* w* (r)

CodePudding user response:

Try simplifying the result:

syms m ;

eqn=(d m* d* ((sqrt(3))/2)<f); 

M = solve(eqn,m);     
disp (M)


r= (b/2) d*((M-1)*sqrt(3) 2)/(4);

L=simplify(2* pi* M* w* (r))

EDIT

Since L is a numeric value, the answer is:

L = vpa(2* pi* M* w* (r))

CodePudding user response:

You can also use :

eval(L) 

to convert the anser from symbolic to double ( if there isn't a symbolic variable left in the expression).

  • Related