16 lines
238 B
Text
16 lines
238 B
Text
function r = cube(x)
|
|
r = x.^3;
|
|
endfunction
|
|
|
|
function r = croot(x)
|
|
r = x.^(1/3);
|
|
endfunction
|
|
|
|
compose = @(f,g) @(x) f(g(x));
|
|
|
|
f1 = {@sin, @cos, @cube};
|
|
f2 = {@asin, @acos, @croot};
|
|
|
|
for i = 1:3
|
|
disp(compose(f1{i}, f2{i})(.5))
|
|
endfor
|