2.如何用matlab 根据y=1+1/3+1/5+L +1/(2n-1),求(1)y
问题描述:
2.如何用matlab 根据y=1+1/3+1/5+L +1/(2n-1),求(1)y
答
function [Y,N] = qiumin
for n = 1:10000
y=f(n);
if y>3
N = n;
Y = y;
return;
end
end
function y = f(n)
y=0;
for i = 1:n
y = y+1/(2*i-1);
end