Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 270270

Submitted on 1 Jul 2013 by Binbin Qi

Correct

16Size
Leading solution size is 10.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
seconds = 10;
distance_correct = 2.1333;
assert( abs (distance_correct - LightningDistance(seconds)) < 0.0001)
ans =
    2.1333
2
Pass
 
%%
seconds = 6;
distance_correct = 1.28;
assert( abs (distance_correct - LightningDistance(seconds)) < 0.0001)
ans =
    1.2800
3
Pass
 
%%
seconds = 3;
distance_correct = 0.6400;
assert( abs (distance_correct - LightningDistance(seconds)) < 0.0001)
ans =
    0.6400
4
Pass
 
%%
seconds = 1;
distance_correct = 0.2133;
assert( abs (distance_correct - LightningDistance(seconds)) < 0.0001)
ans =
    0.2133