how to create symbolic function?

2 visualizaciones (últimos 30 días)
Michal
Michal el 30 de Oct. de 2017
Comentada: Michal el 9 de Mayo de 2021
I need to transform the following function to the symbolic form to evaluate it with arbitrary precision.
Z(N,Thetas) = prod((1 - exp(-(N:-1:2).*Thetas))./(1 - exp(-Thetas)),2)
where Thetas is matrix M x N-1 of the positive real numbers. So the expected result is vector Z (M x 1). I am not able to rewrite function Z to symbolic form and than evaluated it by vpa() command.
Any idea how to effectively solve it?

Respuesta aceptada

Michal
Michal el 30 de Oct. de 2017
Editada: Michal el 30 de Oct. de 2017
function Z=symZ(N,Thetas,Ndigit)
Thetas = sym(Thetas);
Zsym = prod((1 - exp(-(N:-1:2).*Thetas))./(1 - exp(-Thetas)),2);
Z = vpa(Zsym,Ndigit);
end

Más respuestas (1)

Alfonso Salas-Cruz
Alfonso Salas-Cruz el 9 de Mayo de 2021
how evaluate an symbolic expresion?
  1 comentario
Michal
Michal el 9 de Mayo de 2021
use the "vpa" command:
Z = vpa(Zsym,Ndigit);

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by