'Function handle as input to the function handle
Is it possible in Matlab to create function handle that will take as input another function handle and how?
e.g. I have h = @(x) x^2
I want to have h as parameter and get as output function that 4*x^2
function alpha = fun(h, type)
x= sym('x',[8,1]);
gamma = 16;
alpha_ = gamma*h(x);
alpha = matlabFunction(alpha_, 'vars', {x});
end
Is it possible to create something like that? I want to avoid creating alphas for multiple function handles.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|