How do you find the maximum error in series?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Semiconductors and Converters dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!