MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Correct

23Size

Leading solution size is 20.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

1 player likes this solution

Test

Code Input and Output

1

Pass

%% myf=@(x) det(x); yourf = flexf(myf); x={[1 2;3 4],7,[1 2 3; 4 5 6; 2 3 1],3,[2 -1 ; 1 -1]}; [a,~,b,c]=yourf(x{:}); y_correct = {-2 9 3}; assert(isequal({a b c},y_correct));

2

Pass

%% myf=@(x) x.^2; yourf = flexf(myf); x={[1 2;3 4],7,[1 2 3; 4 5 6; 2 3 1],3,[2 -1 ; 1 -1]}; [a,~,b,c]=yourf(x{:}); y_correct = cellfun(myf,x,'uni',0); assert(isequal({a b c},y_correct([1 3 4])));

2 Comments