Cody

Solution 567842

Submitted on 28 Jan 2015 by Yannick
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% fh=@sin; x0=pi/4; h=1e-4; y_correct = 0.707106780007960; tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

2   Pass
%% fh=@(x) x^2+1; x0=2; h=1e-4; y_correct = 4.000000 tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

y_correct = 4

3   Pass
%% fh=@(x) 3*sqrt(x^2+1); x0=5; h=1e-4; y_correct = 2.941742027049443 tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

y_correct = 2.9417

Suggested Problems