
%Main Program for FDnonuniform

% Modified January 2017

% Data is provided for the function FDnonuniform
% The data consists of providing the function, the derivative being
% approximated, and relevant derivatives to compute the error.
% I have done this in two different ways: 1) defining external functions
% and 2) defining the functions inside this code. Both ways work.

close all;
clear all;

% Order of the derivative
k=2; % If k is changed provide new fkp

% Point at which the derivative will be approximated

xb = 1/2;

% Grid points
xpts = [ xb-1e-1; xb; xb+1e-1];
 
 % Functions
 f = @(x) exp(x/3);
 
 % Second derivatives
 f2p = @(x) 1/9*f(x);
 
  % Third derivatives
 f3p = @(x) 1/27*f(x);
 
  % Fourth derivatives
 f4p = @(x) 1/81*f(x);
 
fprintf(' **************************************************************\n')
fprintf('Exercise 1.5 (d) (i) \n')


%FDnonuniformNew ('f','fkp','fnp','fn1p',k,xb,xpts)

FDnonuniformNew (f,f2p,f3p,f4p,k,xb,xpts)





 
 



