Finding absolute and approximate errors

Given the approximation series of the logarithmic function below,
(I’m not sure how to express this equation so I had to take a picture of it, sorry)
I want to write a function, called error comparison, that determines both the absolute and relative errors of the approximation as a function of the approximation order, n, and the value of x.
[abserror,relerror] = error_comparison(x,n)
abserror= abs(x - n)
relerror: abs(x - n) / min(abs(x), abs(n))
any suggestions on how to continue?

2 件のコメント

Jan
Jan 2012 年 11 月 2 日
"Your plot labels should be..." seems to show, that this is a homework question. Please mention this explicitly, because homework question require a different strategy for answering: If a complete solution is posted, you cannot submit the homework without cheating anymore.
José-Luis
José-Luis 2012 年 11 月 2 日
Try and write your equation first. If you don't know how, please read the getting started part of the documentation, and ask a more specific question in this forum. This looks like homework. It is generally frowned upon to ask other people to do your homework.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2012 年 11 月 2 日
編集済み: Jan 2012 年 11 月 2 日

0 投票

Now you should implement the formula as a function. Now there are two alternatives: Either create two for loops to vary n and x, or insert the loop over n inside the function foir the stimation of ln and let this function reply the values for 1:n.
If you get explicit problems with the implementation, please append them to your question by editing and mark this by a "[EDITED]" tag in the text.

カテゴリ

ヘルプ センター および File ExchangeData Type Identification についてさらに検索

質問済み:

2012 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by