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 290831

Submitted on 27 Jul 2013 by Claudio Gelmi

Correct

20Size
Leading solution size is 13.
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
 
%%
assert(isequal(mystery(1:5),[111 301 315 2301 2325]))
[Warning: Function /users/msssystem7/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In mystery at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
2
Pass
 
%%
assert(isequal(mystery(6:10),[809 2120 1413 1422 1320]))
[Warning: Function /users/msssystem7/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In mystery at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
3
Pass
 
%%
assert(isequal(mystery(46:50),[1809 1319 1201 405 612]))
[Warning: Function /users/msssystem7/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In mystery at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
4
Pass
 
%%
x=1:50;
m=mystery(x);
assert(all(m==round(m)))
y=spline(x,m,[12.5 37.5]);
assert(all(y==[704.84846527373202 1283.5708406360138]))
[Warning: Function /users/msssystem7/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In mystery at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]