Define matrix function to output matrix
Afficher commentaires plus anciens
Hello
I want to define sqrt function for matrix with f= fumn(A , sqrt) .
But I can not use this form of definition of matrix function for every function such 1/x or exp(-x) , exp(- sqrt(x)),...
I will be grateful offer your suggestions to me.
thank you
Réponses (1)
A = rand(3);
fumn(A, @sqrt)
fumn(A, @(x) 1 ./ x)
fumn(A, @(x) exp(-x))
function f = fumn(A, fcn)
f = fcn(A);
end
Catégories
En savoir plus sur Numeric Types dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!