write a MATLAB program to determine the n^th number in the Fibonacci sequence

F0 = 0; F1 = 1; Fn+2 = Fn+1 + Fn; n 0
1. By default MATLAB will use double precision for all numeric values unless you specify otherwise. For which n will Fn over ow? What does your program report as Fn in this case?
2. Modify your program to force the use of unsigned 32-bit integers. You can do this by modifying n with n = uint32(n); F1 = uint32(0); F2 = uint32(1);. Any variables calculated using only unsigned 32-bit integer variables will become unsigned 32-bit integer variables themselves unless you specify otherwise. For which n will Fn overflow? What does your program report as Fn in this case?

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2013년 10월 21일

댓글:

ES
2013년 10월 21일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by