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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Partial Differential Equation Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!