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 319804

Submitted on 16 Sep 2013 by LY Cao

Correct

10Size
Leading solution size is 7.
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
 
%%
x = rrm;
assert(x>0)
assert(x/2==0)
ans =
  4.9407e-324
2
Pass
 
%%
x = rrm*[1:10]/2/rrm;
x_correct = [0 1 2 2 2 3 4 4 4 5];
assert(isequal(x,x_correct))
ans =
  4.9407e-324
ans =
  4.9407e-324
3
Pass
 
%%
x = rrm*[2:16]/3/rrm;
x_correct = kron(1:5,ones(1,3));
assert(isequal(x,x_correct))
ans =
  4.9407e-324
ans =
  4.9407e-324
4
Pass
 
%%
% return A022852 sequence - integer nearest n*e - without 'round':
n = 1:17;
x = rrm*n*exp(1)/rrm;
x_correct = [3 5 8 11 14 16 19 22 24 27 30 33 35 38 41 43 46];
assert(isequal(x,x_correct))
ans =
  4.9407e-324
ans =
  4.9407e-324