How do you find the maximum error in series?

1 次查看(过去 30 天)
clear all, close all
%Case 1: Find FN for N (being a value based on a user's input)
FN = 0; x=.75;
prompt = 'What is the value of N? ';
N = input(prompt);
for n = 1:N
FN = FN + (((-1)^(n+1))*(x^n))/(n);
end
fprintf(' Case 1: Value of FN for N = %4i is %6i \n\n',N,FN)
% Case 2: Find maximum value of N such that FN <= ln(1.75)
LN = log(1+x); FN = 0; n = 2;
while FN > LN
n = n+1;
FN = FN + (((-1)^(n+1))*(x^n))/(n);
end
N = n;
fprintf(' Case 2: Value of FN = %6i for N = %4i \n\n',FN,N)
%
% end of program
THE FIRST CASE OF THE PROGRAM WORKS HOWEVER I CANNOT FIGURE OUT HOW TO FIND THE MAXIMUM VALUES THAT "N" CAN BE.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Partial Differential Equation Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by