怎么用matlab求三角形面积比

 

代码如下:如有帮助,请采纳一下,谢谢
 

Acoordinate=input('[x1 y1 z1]=');
Bcoordinate=input('[x2 y2 z2]=');
Ccoordinate=input('[x3 y3 z3]=');
x1=Acoordinate(1,1);
y1=Acoordinate(1,2);
z1=Acoordinate(1,3);
x2=Bcoordinate(1,1);
y2=Bcoordinate(1,2);
z2=Bcoordinate(1,3);
x3=Ccoordinate(1,1);
y3=Ccoordinate(1,2);
z3=Ccoordinate(1,3);
a=sqrt(power(x1-x2,2)+power(y1-y2,2)+power(z1-z2,2));
b=sqrt(power(x2-x3,2)+power(y2-y3,2)+power(z2-z3,2));
c=sqrt(power(x3-x1,2)+power(y3-y1,2)+power(z3-z1,2));
clength=a+b+c;
p=clength/2;
svalue=sqrt(p*(p-a)*(p-b)*(p-c));
triresult=['三角形的周长为:',num2str(clength),';其面积为:',num2str(svalue)];
disp(triresult);