作业帮 > 综合 > 作业

matlab显示格式>> format short>> pians =3.1416>> format long>> pi

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/08 15:47:47
matlab显示格式
>> format short
>> pi
ans =
3.1416
>> format long
>> pi
ans =
3.14159265358979
>> format short e
>> pi
ans =
3.1416e+000
>> format long e
>> pi
ans =
3.141592653589793e+000
书上说short是4位小数,long是15为数,short e是5位科学计数法,long e是15位科学计数法,为啥long e后面有15个数.书有没有错
matlab显示格式>> format short>> pians =3.1416>> format long>> pi
应该是书上有误,matlab没错.你看下帮助文件:
Floating-point format, with 15 digits after the decimal point for double; and 7 digits after the decimal point for single. For example, 3.141592653589793e+0
longe 指小数点后有15位. 当然科学计数法时,小数点前也只有一位.
再问: 什么意思,能继续解释下吗,把我提得short 、long 、long e和short e举下可能犯错的例子,特别是longe(小数点前也只有一位)是什么意思
再答: short Scaled fixed-point format, with 4 digits after the decimal point. For example, 3.1416. 表示定点格式,小数点位置不变化,小数点后显示四位小数。 shorte Floating-point format, with 4 digits after the decimal point. For example,. 小数点位置变化的格式(也就是科学计算法),小数点后显示四位小数。 小数点前也只有一位意思是科学计数法后,只有个位,没有十位百位的意思。 long longe 与上面同理,只不过把4位变成了15位而已。