利用matlab写出给定平面任意两点坐标,求两点间的距离
时间: 2024-05-16 21:12:43 浏览: 347
可以使用Matlab中的内置函数`pdist2`来计算两个点的欧几里得距离。以下是一个简单的示例代码:
```matlab
% 定义两个二维点的坐标
point1 = [1 2];
point2 = [4 6];
% 使用pdist2函数计算两点之间的欧几里得距离
distance = pdist2(point1, point2);
% 输出结果
disp(distance);
```
输出结果为:
```
5
```
这表示点`(1,2)`和点`(4,6)`之间的欧几里得距离为`5`。
阅读全文
相关推荐











