This solution is outdated. To rescore this solution, sign in.
This problema keeps returning an error which, to my understanding, does not make sense, since my function has only 5 lines.
Error using compose (line 85) First argument must be a string array, character vector, or cell array of character vectors. Error in TestPoint1 (line 4) h = compose(f1,f2,f3);
Apologies for the trouble! I have renamed to the function to "composeFcn" to avoid clashing with the MATLAB "compose" function. Give it a try now.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
f1 = @(x)x+1;
f2 = @(x)3*x;
f3 = @sqrt;
h = compose(f1,f2,f3);
assert(isequal(h(9),10));
|
2 | Fail |
f = repmat({@(x)x+1},1,100);
h = compose(f{:});
assert(isequal(h(0),100));
|
3 | Fail |
f = @(x)x;
h = compose(f);
assert(isequal(h(1234),1234));
|
272 Solvers
312 Solvers
2538 Solvers
432 Solvers
2334 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!