这个函数将在Qa定点数字。b格式小数where "a" is the number of bits to the left of the binary point not including the sign bit, and "b" is the number of bits to the right of the decimal point. The input format is either binary or hexadecimal (hex is the default). The function is called by the command "q2dec(x,a,b,format)" where x is a string representing the input number in Qa.b format, "a" is "a" is the number of bits to the left of the binary point not including the sign bit, "b" is the number of bits to the right of the decimal point, and format is either 'bin' or 'hex' (format is optional, 'hex' is the default).
例如,下面的命令可以转换十六进制数字0 x4000 Q0.15(也称为最喜欢)十进制格式:
> > q2dec (' 4000 ', 0, 15)
ans =
0.5000
下面的命令可以转换成二进制数1100000000000000 Q0.15(也称为最喜欢)十进制格式:
> > q2dec(' 1100000000000000 ', 0, 15日,“本”)
ans =
-0.5000
几个数字可以在一次调用转换通过将每个输入矩阵的行数:
> > x = [‘8000’;“C000”;“0000”;' 4000 ');
> > q2dec (x 0 15)
ans =
-1.0000
-0.5000
0
0.5000
看到我的其他提交dec2q小数转换为Qa。b格式。
引用作为
约瑟夫(2023)。定点小数转换器Q格式(//www.tianjin-qmedu.com/matlabcentral/fileexchange/61670-fixed-point-q-format-to-decimal-converter), MATLAB中央文件交换。检索。
版本 | 发表 | 发布说明 | |
---|---|---|---|
1.0.0.0 |