Multiplicate Symbolic Variable with Real Number

Hello, I'm student, in my script I have a symbolic variable and I need to multiplicate with a real number, matlab does this but in a strange way:
example of my code:
syms x;
b=2^x;
c=2.9399*b;
I expect this:
2.9399*2^x
But MatLab return this:
(29399*2^x)/10000
in my script I get this and is hard to read (for a human ^^):
(6619970094463307*2^x)/2251799813685248
note that the division is right, it is 2.9399; any suggestion to have the form that I need? thanks

 Respuesta aceptada

Star Strider
Star Strider el 25 de Jun. de 2014
The vpa function is your friend here:
syms x;
b=2^x;
c=2.9399*b
c = vpa(c, 5)
produces:
c =
2.9399*2.0^x

2 comentarios

Nome
Nome el 25 de Jun. de 2014
thank you so much, working perfectly
Star Strider
Star Strider el 25 de Jun. de 2014
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Etiquetas

Preguntada:

el 25 de Jun. de 2014

Comentada:

el 25 de Jun. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by