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 431938

Submitted on 15 Apr 2014 by Alfonso Nieto-Castanon

Correct

31Size
Leading solution size is 16.
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 = 10;
y_correct = [0.625 4];
assert(isequal(extract(x),y_correct))

                    
2
Pass
 
%%
x = 3.1416;
y_correct = [0.7854 2];
assert( abs(sum(extract(x) - y_correct)) < 0.0001)

                    
3
Pass
 
%%
x = -3;
y_correct = [-0.7500 2];
assert( abs(sum(extract(x) - y_correct)) < 0.0001)

                    
4
Pass
 
%%
x = realmax('single');
y_correct = [1 128];
assert( abs(sum(extract(x) - y_correct)) < 0.0001)

                    
5
Pass
 
%%
x = 0;
y_correct = [0 0];
assert(isequal(extract(x),y_correct))