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?

回答 (2 件)

ES
ES 2013 年 10 月 21 日
編集済み: ES 2013 年 10 月 21 日

0 投票

Homework ain't it? There is a question on the same in Cody. Check out..

カテゴリ

質問済み:

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