注册 登录
编程论坛 Matlab

输入两个坐标求距离 NORM具体求法 步骤

汉堡爱天气 发布于 2013-05-21 23:12, 791 次点击
NORM
1 回复
#2
unix19932013-07-31 16:15
程序代码:
function distance = dist2 (x1, y1, x2, y2)
distance = sqrt((x2-x1).^2 + (y2-y1).^2);
disp('Calculate the distance between two points:');
ax = input ('Enter x value of point a:');
ay = input ('Enter y value of point a:');
bx = input ('Enter x value of point b:');
by = input ('Enter y value of point b:');
result = dist2 (ax, ay, bx, by);
fprintf('The distance between points a and b is %f \n', result);

嘿嘿,我是一个初学者。
1