Cody

# Problem 44478. Exponential decay

Solution 3201451

Submitted on 14 Oct 2020 by Rafael S.T. Vieira
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)

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

[Warning: RelTol has been increased to 2.22045e-14.] [> In odearguments (line 130) In ode45 (line 115) In decay (line 9) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

[Warning: RelTol has been increased to 2.22045e-14.] [> In odearguments (line 130) In ode45 (line 115) In decay (line 9) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

[Warning: RelTol has been increased to 2.22045e-14.] [> In odearguments (line 130) In ode45 (line 115) In decay (line 9) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

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

[Warning: RelTol has been increased to 2.22045e-14.] [> In odearguments (line 130) In ode45 (line 115) In decay (line 9) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)] [Warning: RelTol has been increased to 2.22045e-14.] [> In odearguments (line 130) In ode45 (line 115) In decay (line 9) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

### Community Treasure Hunt

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

Start Hunting!