From: "Nina " <>
Newsgroups: comp.soft-sys.matlab
Subject: 3rd derivative function
Date: Thu, 10 May 2012 15:28:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <jogmqk$hqn$>
Reply-To: "Nina " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1336663700 18263 (10 May 2012 15:28:20 GMT)
NNTP-Posting-Date: Thu, 10 May 2012 15:28:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3392200
Xref: comp.soft-sys.matlab:767412

Hello everybody,

I know this is really simple but I can't see what's wrong now. I'm trying to write a 3rd derivative approximation that uses the first derivative, of an initial function that is the exponential. I've been trying to run this code:

if x >=0 
    then f(x) = exp((x));
if x <0
    then f(x) = 1/(exp((-x)));
f1(x) = (f(x+h)-f(x-h))/(2*h);
f3(x) = (3/(h^3))*(f(x+h)-f(x-h)-2*h*f1(x))

but MATLAB refuses it saying 

Undefined function 'f' for input arguments of type 'double'.

Please, does anyone have any idea what could be wrong?
Thanks in advance!