write a function called tri_area that returns the area of a triangle with base b and height h, where b and h are input arguments of the function in that order. in matlab

main.m
function area = tri_area(b, h)
    % This function  calculates the area of a triangle
    % using the formula : area = 0.5 * base * height
    area = 0.5 * b * h;
end
167 chars
6 lines

This function takes in two input arguments, the base and height of the triangle, and returns the area of the triangle using the formula 0.5 * base * height. The area variable is used to store the computed area of the triangle and is returned as the output of the function.

gistlibby LogSnag