MATLAB: What is code to call a function

helpMATLAB

question asks for code to call a function what is this and please explain in detail for this function so that even a layman can understand
function [area] = tri_area(b,h)
tri_area(b,h)= 1/2*(b)*(h);
area= tri_area(b,h);
end

Best Answer

The function should be written like this and saved as tri_area.m
function [area] = tri_area(b,h)
area=1/2*(b)*(h);
end
Then in MATLAB Command Window, call the function like this
TheArea=tri_area(4,5)