Vpa conversion of whole file

9 ビュー (過去 30 日間)
Ahmet Parker
Ahmet Parker 2022 年 4 月 20 日
編集済み: John D'Errico 2022 年 4 月 22 日
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 Center および File ExchangeNumbers and Precision についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by