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 235626

Submitted on 25 Apr 2013 by Michael C.

Correct

18Size
Leading solution size is 11.
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=[0:10]
y=[12:12:132]
xdash=6.6
ydash = 91.2;
assert(isequal(Lookup(x,y,xdash),ydash))
x =
  Columns 1 through 7
             0          1.00          2.00          3.00          4.00          5.00          6.00
  Columns 8 through 11
          7.00          8.00          9.00         10.00
y =
  Columns 1 through 7
         12.00         24.00         36.00         48.00         60.00         72.00         84.00
  Columns 8 through 11
         96.00        108.00        120.00        132.00
xdash =
          6.60
2
Pass
 
%%
x=[1:10]
y=[10:20:200]
xdash=7.2
ydash = 134;
assert(isequal(Lookup(x,y,xdash),ydash))
x =
  Columns 1 through 7
          1.00          2.00          3.00          4.00          5.00          6.00          7.00
  Columns 8 through 10
          8.00          9.00         10.00
y =
  Columns 1 through 7
         10.00         30.00         50.00         70.00         90.00        110.00        130.00
  Columns 8 through 10
        150.00        170.00        190.00
xdash =
          7.20