how to make a function on matlab code example
Example 1: matlab function
function ave = average(x)
ave = sum(x(:))/numel(x);
end
Example 2: how to write a function in matlab
function f = fact(n)
f = prod(1:n);
end
function ave = average(x)
ave = sum(x(:))/numel(x);
end
function f = fact(n)
f = prod(1:n);
end