Write a MATLAB script named Pi1m that calculates and display
Write a MATLAB script named Pi1.m that calculates and displays an estimate of using a while loop.
Solution
Pi1.m -------
sum=0.0
pi=0.0
i=1
n=input(\'enter n:\')
while(i<=n)
sum=sum+((-1^(i+1))/((2*i)-1))
i++
end
pi=4*sum
fprintf(\'pi estimate :%f\',pi)
