Define matrix function to output matrix
Mostra commenti meno recenti
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
Risposte (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
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!