Given an input real number x and a natural number n, output the row vector with the n first terms of the continued fraction. For more details, you could find help here: http://en.wikipedia.org/wiki/Continued_fraction
Example:
Inputs: x=pi; n = 10;
Output: y = [3 7 15 1 292 1 1 1 2 1];
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers36
Suggested Problems
-
Swap the first and last columns
22632 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3677 Solvers
-
Matrix indexing with two vectors of indices
776 Solvers
-
Vectorize the digits of an Integer
338 Solvers
-
Create a random logical vector of N elements of which M are true.
103 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The result for pi is not really correct after the 13th term--we do not have enough decimal places to go that far. If we use the same method, though, we will generate the same noise.