How do you find the maximum error in series?

1 回表示 (過去 30 日間)
Yianni
Yianni 2014 年 10 月 10 日
編集済み: the cyclist 2014 年 10 月 10 日
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 Center および File ExchangePartial Differential Equation Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by