feature('setprecision') in matlab 2022
23 ビュー (過去 30 日間)
古いコメントを表示
Hello, currently I have matlab 2022a. It seems the command
feature('setprecision')
does not work in it. The function feature itself works but does can not find setprecision. It shows the following error message:
Error using feature
Feature precision not found
Is there a way around this?
Thank you.
0 件のコメント
回答 (1 件)
Venkat Siddarth
2023 年 4 月 4 日
I understand that you are facing issues in using feature function with setprecison parameter.Possible workaround is as follows:
The feature('setprecision') command is used to set the precision of the numeric calculations in MATLAB. However, it seems that you are not able to use 'setprecision' option in Matlab 2022a.
One possible workaround, is to use the vpa() function to perform calculations with a higher precision. vpa() stands for variable precision arithmetic and allows you to specify the desired number of digits for your calculations.
For example, you can use the following code to perform a calculation with 100 digits of precision:
digits(100) %Digits function is used to set the precison used by vpa, by default it is 32 bits
a = vpa(pi)
%But if you want to explicitly change the precison of specific variables you can
%do it as follows and it wont effect the value of "digits".
b = vpa(exp(1),10)
%Note: Arithmetic operation happen according to the value of digits
c=a*b
I hope this resolves the issue
Venkat Siddarth V.
1 件のコメント
Stephen23
2023 年 4 月 4 日
編集済み: Stephen23
2023 年 4 月 4 日
"The feature('setprecision') command is used to set the precision of the numeric calculations in MATLAB. "
The FEATURE function has never been documented. But now we have an official statement from TMW staff, what it is used for. Can you also provide a link to some documentation for this function?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!