Vpa conversion of whole file

6 次查看(过去 30 天)
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

采纳的回答

John D'Errico
John D'Errico 2022-4-22
编辑:John D'Errico 2022-4-22
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by