SUNY Geneseo Department of Mathematics
Wednesday, March 11
Math 230 02
Spring 2015
Prof. Doug Baldwin
fnhandle = @(args) body
@(radius) pi * radius .^ 2
newname = @functionname
fplot
, feval
, fzero
function [ d ] = deriv( f, x )
%DERIV Estimate derivative of F at X
h = 1e-10;
d = ( f(x+h) - f(x-h) ) / ( 2*h);
end
>> deriv( @(x) 2*x, 0 )
ans =
2
>> deriv( @(x) x.^2 + x, 2 )
ans =
5.0000
>> deriv( @tan, 0 )
ans =
1
>> deriv( @resultdemo, 1 )
ans =
2.0000