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 208439

Submitted on 25 Feb 2013

Incorrect

23Size
Leading solution size is 12.
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
Fail
 
%%
x = 1;
y =2;
y_correct = 2;
assert(isequal(round(your_fcn_name(x,y)),y_correct))
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')),'sign * forbidden')
assert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden')
assert(isempty(strfind(filetext, 'cross')),'cross forbidden')
assert(isempty(strfind(filetext, 'prod')),'prod forbidden')
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'mldivide')))
assert(isempty(strfind(filetext, 'mrdivide')))
assert(isempty(strfind(filetext, '/')),'/ forbidden')
assert(isempty(strfind(filetext, '\')))
assert(isempty(strfind(filetext, '-')))
assert(isempty(strfind(filetext, '^')),'^ forbidden')
assert(isempty(strfind(filetext, 'dot')))
assert(isempty(strfind(filetext, '''')),'string forbidden')
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".
2
Fail
 
%%
x = 8;
y =25;
y_correct = 200;
assert(isequal(round(your_fcn_name(x,y)),y_correct))
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')))
assert(isempty(strfind(filetext, 'mtimes')))
assert(isempty(strfind(filetext, 'cross')))
assert(isempty(strfind(filetext, 'prod')))
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'dot')))
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".
3
Fail
 
%%
x = 8;
y =0;
y_correct = 0;
assert(isequal(round(your_fcn_name(x,y)),y_correct))
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')))
assert(isempty(strfind(filetext, 'mtimes')))
assert(isempty(strfind(filetext, 'cross')))
assert(isempty(strfind(filetext, 'prod')))
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'dot')))
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".
4
Fail
 
%%
x = -148;
y =2865;
y_correct = -424020;
assert(isequal(round(your_fcn_name(x,y)),y_correct))
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')))
assert(isempty(strfind(filetext, 'mtimes')))
assert(isempty(strfind(filetext, 'cross')))
assert(isempty(strfind(filetext, 'prod')))
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'dot')))
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".
5
Fail
 
%% Test 5 : randi!!
x = randi([1 58]);
y =286.5;
y_correct = x*y;
assert(abs( your_fcn_name(x,y)-y_correct)<1e-9)
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')))
assert(isempty(strfind(filetext, 'mtimes')))
assert(isempty(strfind(filetext, 'cross')))
assert(isempty(strfind(filetext, 'prod')))
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'dot')))
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".
6
Fail
 
%% Test 6 : randi and pi !!
x = randi([14 580]);
y = -pi;
y_correct = x*y;
assert(abs( your_fcn_name(x,y)-y_correct)<1e-9)
filetext = fileread('your_fcn_name.m');
assert(isempty(strfind(filetext, '*')))
assert(isempty(strfind(filetext, 'mtimes')))
assert(isempty(strfind(filetext, 'cross')))
assert(isempty(strfind(filetext, 'prod')))
assert(isempty(strfind(filetext, 'cumprod')))
assert(isempty(strfind(filetext, 'times')))
assert(isempty(strfind(filetext, 'dot')))
assert(isempty(strfind(filetext, 'num2str')))
assert(isempty(strfind(filetext, 'int2str')))
assert(isempty(strfind(filetext, 'dec2bin')))
Error: Output argument "output" (and maybe others) not assigned during call to "/users/msssystem15/your_fcn_name.m>your_fcn_name".