资源简介
函数输入三角形三个点坐标,输出费马点坐标,如果三角形顶角大于120度,则输出的点在三角形外部,使用者可在主函数中自行判断是否使用该点。
代码片段和文件信息
function [a3a4]=fermatpoint(x1y1)
syms x y
b=y1(1)-(y1(1)-y1(2))/(x1(1)-x1(2))*x1(1);
if (y1(3)-(y1(1)-y1(2))/(x1(1)-x1(2))*x1(3)-b)>0
if y1(1)>y1(2)
if x1(1)>x1(2)
A=[x1(2);y1(2)];
B=[x1(1);y1(1)];
AB = B - A;
theta = deg2rad(60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
else
A=[x1(2);y1(2)];
B=[x1(1);y1(1)];
AB = B - A;
theta = deg2rad(-60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
end
else
if x1(1)>x1(2)
A=[x1(1);y1(1)];
B=[x1(2);y1(2)];
AB = B - A;
theta = deg2rad(-60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
else
A=[x1(1);y1(1)];
B=[x1(2);y1(2)];
AB = B - A;
theta = deg2rad(60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
end
end
else
if y1(1)>y1(2)
if x1(1)>x1(2)
A=[x1(2);y1(2)];
B=[x1(1);y1(1)];
AB = B - A;
theta = deg2rad(-60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
else
A=[x1(2);y1(2)];
B=[x1(1);y1(1)];
AB = B - A;
theta = deg2rad(60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
end
else
if x1(1)>x1(2)
A=[x1(1);y1(1)];
B=[x1(2);y1(2)];
AB = B - A;
theta = deg2rad(60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
else
A=[x1(1);y1(1)];
B=[x1(2);y1(2)];
AB = B - A;
theta = deg2rad(-60);
T = [cos(theta) sin(theta); -sin(theta) cos(theta)];
C = A + T*AB;
end
end
end
b1=y1(2)-(y1(2)-y1(3))/(x1(2)-x1(3))*x1(2);
if (y1(1)-(y1(2)-y1(3))/(x1(2)-x1(3))*x1(1)-b1)>0
if y1(2)>y1(3)
if x1(2)>x1(3)
A1=[x1(3);y1(3)]
- 上一篇:熵权法求权重MATLAB源码
- 下一篇:bp神经网络工具箱
相关资源
- 熵权法求权重MATLAB源码
- matlab求解非线性方程组
- 遗传算法完整MATLAB程序覆盖法
- 灰色预测Mmatlab程序
- matlab元胞自动机交通网模拟
- MATLAB实现ARQ
- MATLAB中ARQ程序代码
- 弹道图绘制-matlab代码
- LCL的三相三线制APF仿真程序
- 串级控制仿真
- matlab程序171630
- matlab 无代码 步进电机控制
- matlab 无代码 无刷电机控制
- matlab心电信号处理
- ID3算法 matlab代码实现
- 利用matlab将风场nc文件读取成txt文件
- KLTransform
- 最优化三点二次插值Matlab
- 普通端射阵天线的MATLAB 程序
-
微燃机Matlab/simuli
nk建模 - LSB嵌入水印与提取基于MATLAB的实现
- matlab双极性二进制基带传输系统的仿
- MATLAB 模糊PID仿真文件
- matlab水果识别程序171419
- Matlab基本实验微分方程画图
- 矩形贴片天线Matlab仿真
- matlab计算复合材料板ABD程序
- 雷达MATLAB仿真171350
- matlab对两张彩色图进行直方图匹配并
- (212)和(317)卷积码编解码的MTAL
评论
共有 条评论