From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: taylor polynomial evaluation
Date: Sat, 15 Nov 2008 01:17:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <gfl7ue$un$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1226711822 983 (15 Nov 2008 01:17:02 GMT)
NNTP-Posting-Date: Sat, 15 Nov 2008 01:17:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1581815
Xref: comp.soft-sys.matlab:500935

Hi, I am trying to evaluate log(x) by using  taylor polynomial with degree that will approximate it as accurately as possible, on interval 0.5-1.5. For some reason, my code does not work right from 1 to 1.5, although the results from 0.5 to 1.5 are OK. Can anyone see what the problem is? (sorry, I am new to MATLAB, it's probably really simple)
function taylor1(a,b)
% a=0.5, b=1.5
for x=a:0.01:b

fprintf('t=%2.10g \n',t)
fprintf('x=%1.2g \n',x)

Also, does anyone know how to display the results in a nice readable form?
Thank you all,