Answers for "matlab function"

14

declaring a function in matlab

%%%% general syntax %%%%%%%%%%%%%
function [return parameters] = name_of_function(attributes)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    body_of_the_function
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
end
Posted by: Guest on July-23-2020
4

matlab function

function ave = average(x)
    ave = sum(x(:))/numel(x); 
end
Posted by: Guest on February-25-2020
0

how to write a function in matlab

function f = fact(n)
    f = prod(1:n);
end
Posted by: Guest on March-31-2020

Browse Popular Code Answers by Language