To display 10 digits of pi in Matlab, you can use the following code:
main.m46 chars4 lines
Explanation:
format longG
sets the display format to show 15 significant digits of the result.vpa()
is used to increase the precision of pi
up to 10 digits.disp()
displays the value of piVal
.Output:
main.m12 chars2 lines
gistlibby LogSnag