(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Via iteration. A continued fraction for pi is:

Write an algorithm to compute this to n terms using Matlab.

1st term would be 3+1/9

3. The attempt at a solution

p = '1';

for k = 1:n

p=3+(-1+2^n)/(3+p);

end

p

I'm very new to programming, and I can only think of this.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Continued fraction for pi

**Physics Forums | Science Articles, Homework Help, Discussion**