Define matrix function to output matrix
이전 댓글 표시
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
답변 (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
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!