Cody

Solution 1404086

Submitted on 4 Jan 2018 by David Verrelli
  • Size: 13
  • This is the leading solution.
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
t = 0; x_correct = 1; assert(abs(decay(t)-x_correct)<1e-10)

ans = 1

2   Pass
t = 2; x_correct = exp(-1); assert(abs(decay(t)-x_correct)<1e-10)

ans = 0.3679

3   Pass
t = 2000; x_correct = 0; assert(abs(decay(t)-x_correct)<1e-10)

ans = 0

4   Pass
t = 2e-5; x_correct = 1 - 1e-5; assert(abs(decay(t)-x_correct)<1e-10)

ans = 1.0000

5   Pass
t = [0 1 2]; x_correct = [1 exp(-0.5) exp(-1)]; assert(all(abs(decay(t)-x_correct)<1e-10))

ans = 1.0000 0.6065 0.3679

Suggested Problems