matlab调用函,求矩形的面积和周长

2024-11-28 10:31:54
推荐回答(1个)
回答1:

function SRECT = SRECT(a,b)

switch(nargin)
case 1
SRECT = a*a;
case 2
SRECT = a*b;
otherwise
disp('请输入矩形的长和宽数据!');
end