MATLAB: Write a function called tri_area returns the area of a triangle with base b and height h

matlab function

hello this is my function code and command window code and there is a message of invalid expression at line 2 and i dont know what is the wrong can anyone help me
function [area] = tri_area([b,h]);
tri_area([b,h])=(0.5)*(b)*(h)
area=tri_area([b,h])
end
%command window
area = tri_area[3,2])

Best Answer

function area = tri_area(b,h)
area = 0.5*b*h;
end
From the command window
A = tri_area(3,2)