define function in atlab code example
Example 1: function maltab
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