[Why?] Error using diffex Not enough input arguments.

7 views (last 30 days)
I'm really a fresh user about Matlab, I type the code which is in our textbook as follwing:
function diffex(func,dfunc,x,n)
format long
dftrue=dfunc(x);
h=1;
H(1)=h;
D(1)=(func(x+h)-func(x-h))/(2*h);
E(1)=abs(dftrue-D(1));
for i=2:n
h=h/10;
H(i)=h;
D(i)=(func(x+h)-func(x-h))/(2*h);
E(i)=abs(dftrue-D(i));
end
L=[H' D' E']';
fprintf(' step size finite difference true error\n');
fprintf('%14.10f %16.14f %16.13f\n',L);
loglog(H,E),xlabel('Step Size'),ylabel('Error')
title('Plot of Error Versus Step Size')
format short
BUT! there was an error and I don't konw why:
Error using diffex (line 3)
Not enough input arguments.
I hope someone can teach me how to deal with this .

Answers (1)

Image Analyst
Image Analyst on 28 Apr 2015
Type "doc diffex" on the command line.

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!