Vpa conversion of whole file

15 visualizaciones (últimos 30 días)
Ahmet Parker
Ahmet Parker el 20 de Abr. de 2022
Editada: John D'Errico el 22 de Abr. de 2022
Hi,
I have a matlab code which has many lines of code. I need variable precision arithmetic calculations. I want to use vpa and digits().
I do not want to convert all my files (inputs, assignments, initializations) into vpa() format. Is there an easy way to do it?
All my calculations will be in variable precision arithmetic (vpa). I want to see if using more digits change my results.
Thanks in advance

Respuesta aceptada

John D'Errico
John D'Errico el 22 de Abr. de 2022
Editada: John D'Errico el 22 de Abr. de 2022
I'm sorry. You cannot now convert those files automatically, to take lines like
a = 5;
And automatically have MATLAB see those lines as
a = vpa(5);
with some number of digits specified, where all double precision numbers as created in all of your files are now converted automatically and on the fly to VPA.
Could you use some text processing to do so? That is possible if your code if pretty simplistic, but I would consider it suspect unless you are highly skilled at using tools like regular expressions in MATLAB, and even then, I'd be wary of bugs you may introduce.
Oh, and even if you could do this? Your code would now run quite slowly, because MATLAB is not optimized to use all symbolic computations.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by