function [out1 out2]=PiEst(n) %n is the number of steps
x=1/3^.5
x1=x
x2=x
for i=2:n
x1=((1+x1^2)^.5-1)/x1
x2=x2/((1+x1^2)^.5+1)
end
out1=x1
out2=x2
end
any other matlab questions, feel free to ask. I taught a course on matlab computations
This post was edited by TheStealthTarget on Jan 23 2015 04:49am