Matlab:如何将 matlab 中的计算精度降低到 4 位数?
Matlab: How to decrease the precision of calculations in matlab to let's say 4 digits?
我想知道有什么方法可以告诉 Matlab 所有计算都需要完成并继续,假设是 4 位数字。
format long 或其他格式我认为是为了以特定精度显示结果,而不是为了它们的值精度。
使用digits
:http://www.mathworks.com/help/symbolic/digits.html
digits(d)
将当前 VPA 精度设置为 d 位有效小数位。 d的值必须是大于1小于2^29+1的正整数。
您是否希望通过不使用双精度来提高性能或节省内存?如果是这样,那么可变精度算术和 vpa
(符号数学工具箱的一部分)可能不是正确的选择。相反,您可以考虑 fixed point arithmetic. This type of math is mostly used on microcontrollers and architectures with memory address widths of less than 32 bits or that lack dedicated floating point hardware. In Matlab you'll need the Fixed Point Designer toolbox. You can read more about the capabilities here.
我想知道有什么方法可以告诉 Matlab 所有计算都需要完成并继续,假设是 4 位数字。
format long 或其他格式我认为是为了以特定精度显示结果,而不是为了它们的值精度。
使用digits
:http://www.mathworks.com/help/symbolic/digits.html
digits(d)
将当前 VPA 精度设置为 d 位有效小数位。 d的值必须是大于1小于2^29+1的正整数。
您是否希望通过不使用双精度来提高性能或节省内存?如果是这样,那么可变精度算术和 vpa
(符号数学工具箱的一部分)可能不是正确的选择。相反,您可以考虑 fixed point arithmetic. This type of math is mostly used on microcontrollers and architectures with memory address widths of less than 32 bits or that lack dedicated floating point hardware. In Matlab you'll need the Fixed Point Designer toolbox. You can read more about the capabilities here.