from calculate_tr import *
import math
i = float(input("请输入第一架已知信号的飞机:"))
j = float(input("请输入第二架已知信号的飞机:"))
k = float(input("请输入未知信号的飞机:"))
"""
输入的角度为角度制
"""
a_ij = float(input("请输入第夹角a_ij:")) * math.pi / 180
a_oj = float(input("请输入第夹角a_oj:")) * math.pi / 180
a_oi = float(input("请输入第夹角a_oi:")) * math.pi / 180
r = float(input("请输入半径大小:"))
if k > j > i:
if a_ij > a_oi and a_ij > a_oi:
x = Symbol('x')
y = Symbol('y')
m = Symbol('m')
n = Symbol('n')
"""
第一个圆的计算程序
"""
[a, b] = (
solve([((x - r * cos(2 * math.pi * (i - 1) / 9) / 2) ** 2) + (
y - r * sin(2 * math.pi * (i - 1) / 9) / 2) ** 2 - (r / (
2 * tan(a_oi))) ** 2,
(x - r * cos(2 * math.pi * (i - 1) / 9) / 2) * (r * cos(2 * math.pi * (i - 1) / 9)) + (
y - r * sin(2 * math.pi * (i - 1) / 9) / 2) * (
r * sin(2 * math.pi * (i - 1) / 9))], x, y))
"""把两组解分别保存在a和b中"""
(a_x1, a_y1) = a
(a_x2, a_y2) = b
a_x1_1 = (a_x1 - (r * cos(2 * math.pi * (i - 1) / 9)) / 2)
a_y1_1 = (a_y1 - (r * sin(2 * math.pi * (i - 1) / 9)) / 2)
a_x1_2 = r * cos(2 * math.pi * (i - 1) / 9)
a_y1_2 = r * sin(2 * math.pi * (i - 1) / 9)
a_x2_1 = (a_x2 - (r * cos(2 * math.pi * (i - 1) / 9)) / 2)
a_y2_1 = (a_y2 - (r * sin(2 * math.pi * (i - 1) / 9)) / 2)
a_x2_2 = r * cos(2 * math.pi * (i - 1) / 9)
a_y2_2 = r * sin(2 * math.pi * (i - 1) / 9)
"""分别计算两组解的正弦值,对于第一个圆,应舍去大于0的解"""
a_sin_1 = -(a_x1_1 * a_y1_2 - a_x1_2 * a_y1_1)
a_sin_2 = -(a_x2_1 * a_y2_2 - a_x2_2 * a_y2_1)
print(a_sin_1)
print(a_sin_2)
if a_sin_1 > a_sin_2:
a_x_true, a_y_true = b
else:
a_x_true, a_y_true = a
print(f"第一个圆的圆心坐标为{a_x_true, a_y_true}")
"""求第一个圆的半径"""
r_1 = r / (2 * (sin(a_oi)))
print(f"第一个圆的半径是{r_1}")
"""
第二个圆的计算程序
"""
[e, f] = (
solve([((m - r * cos(2 * math.pi * (j - 1) / 9) / 2) ** 2) + (
n - r * sin(2 * math.pi * (j - 1) / 9) / 2) ** 2 - (r / (
2 * tan(a_oj))) ** 2,
(m - r * cos(2 * math.pi * (j - 1) / 9) / 2) * (r * cos(2 * math.pi * (j - 1) / 9)) + (
n - r * sin(2 * math.pi * (j - 1) / 9) / 2) * (
r * sin(2 * math.pi * (j - 1) / 9))], m, n))
"""把两组解分别保存在a和b中"""
(b_x1, b_y1) = e
(b_x2, b_y2) = f
b_x1_1 = (b_x1 - (r * cos(2 * math.pi * (j - 1) / 9)) / 2)
b_y1_1 = (b_y1 - (r * sin(2 * math.pi * (j - 1) / 9)) / 2)
b_x1_2 = r * cos(2 * math.pi * (j - 1) / 9)
b_y1_2 = r * sin(2 * math.pi * (j - 1) / 2)
b_x2_1 = (b_x2 - (r * cos(2 * math.pi * (j - 1) / 9)) / 2)
b_y2_1 = (b_y2 - (r * sin(2 * math.pi * (j - 1) / 9)) / 2)
b_x2_2 = r * cos(2 * math.pi * (j - 1) / 9)
b_y2_2 = r * sin(2 * math.pi * (j - 1) / 9)
"""分别计算两组解的正弦值,对于第二个圆,应舍去小于0的解"""
b_sin_1 = -(b_x1_1 * b_y1_2 - b_x1_2 * b_y1_1)
b_sin_2 = -(b_x2_1 * b_y2_2 - b_x2_2 * b_y2_1)
if b_sin_1 > b_sin_2:
b_x_true, b_y_true = e
else:
b_x_true, b_y_true = f
print(f"第二个圆的圆心坐标为{b_x_true, b_y_true}")
"""求第二个圆的半径"""
r_2 = r / (2 * (sin(a_oj)))
print(f"第二个圆的半径是{r_2}")
print((
solve([(x - a_x1) ** 2 + (y - a_y1) ** 2 - r_1 ** 2, (x - b_x1) ** 2 + (y - b_y1) ** 2 - r_2 ** 2],
x,
y)))
elif a_oi > a_ij and a_oi > a_oj:
x = Symbol('x')
y = Symbol('y')
m = Symbol('m')
n = Symbol('n')
"""
第一个圆的计算程序
"""
[a, b] = (
solve([((x - r * cos(2 * math.pi * (i - 1) / 9) / 2) ** 2) + (
y - r * sin(2 * math.pi * (i - 1) / 9) / 2) ** 2 - (r / (
2 * tan(a_oi))) ** 2,
(x - r * cos(2 * math.pi * (i - 1) / 9) / 2) * (r * cos(2 * math.pi * (i - 1) / 9)) + (
y - r * sin(2 * math.pi * (i - 1) / 9) / 2) * (
r * sin(2 * math.pi * (i - 1) / 9))], x, y))
"""把两组解分别保存在a和b中"""
(a_x1, a_y1) = a
(a_x2, a_y2) = b
a_x1_1 = (a_x1 - (r * cos(2 * math.pi * (i - 1) / 9)) / 2)
a_y1_1 = (a_y1 - (r * sin(2 * math.pi * (i - 1) / 9)) / 2)
a_x1_2 = r * cos(2 * math.pi * (i - 1) / 9)
a_y1_2 = r * sin(2 * math.pi * (i - 1) / 9)
a_x2_1 = (a_x2 - (r * cos(2 * math.pi * (i - 1) / 9)) / 2)
a_y2_1 = (a_y2 - (r * sin(2 * math.pi * (i - 1) / 9)) / 2)
a_x2_2 = r * cos(2 * math.pi * (i - 1) / 9)
a_y2_2 = r * sin(2 * math.pi * (i - 1) / 9)
"""分别计算两组解的正弦值,对于第一个圆,应舍去大于0的解"""
a_sin_1 = -(a_x1_1 * a_y1_2 - a_x1_2 * a_y1_1)
a_sin_2 = -(a_x2_1 * a_y2_2 - a_x2_2 * a_y2_1)
print(a_sin_1)
print(a_sin_2)
if a_sin_1 > a_sin_2:
a_x_true, a_y_true = b
else:
a_x_true, a_y_true = a
print(f"第一个圆的圆心坐标为{a_x_true, a_y_true}")
"""求第一个圆的半径"""
r_1 = r / (2 * (sin(a_oi)))
print(f"第一个圆的半径是{r_1}")
"""
第二个圆的计算程序
"""
[e, f] = (
solve([((m - r * cos(2 * math.pi * (j - 1) / 9) / 2) ** 2) + (
n - r * sin(2 * math.pi * (j - 1) / 9) / 2) ** 2 - (r / (
2 * tan(a_oj))) ** 2,
(m - r * cos(2 * math.pi * (j - 1) / 9) / 2) * (r * cos(2 * math.pi * (j - 1) / 9)) + (
n - r * sin(2 * math.pi * (j - 1) / 9) / 2) * (
r * sin(2 * math.pi * (j - 1) / 9))], m, n))
"""把两组解分别保存在a和b中"""
(b_x1, b_y1) = e
(b_x2, b_y2) = f
b_x1_1 = (b_x1 - (r * cos(2 * math.pi * (j - 1) / 9)) / 2)
b_y1_1 = (b_y1 - (r * sin(2 * math.pi * (j - 1) / 9)) / 2)
b_x1_2 = r * cos(2 * math.pi * (j - 1) / 9)
b_y1_2 = r * sin(2 * math.pi * (j - 1) / 2)
b_x2_1 = (b_x2 - (r * cos(2 * math.pi * (j - 1) / 9)) / 2)
b_y2_1 = (b_y2 - (r * sin(2 * math.pi * (j - 1) / 9)) / 2)
b_x2_2 = r * cos(2 * math.pi * (j - 1) / 9)
b_y2_2 = r * sin(2 * math.pi * (j - 1) / 9)
"""分别计算两组解的正弦值,对于第二个圆,应舍去小于0的解"""
b_sin_1 = -(b_x1_1 * b_y1_2 - b_x1_2 * b_y1_1)
b_sin_2 = -(b_x2_1 * b_y2_2 - b_x2_2 * b_y2_1)
if b_sin_1 > b_sin_2:
b_x_true, b_y_true = f
else:
b_x_true, b_y_true = e
print(f"第二个圆的圆心坐标为{b_x_true, b_y_true}")
"""求第二个圆的半径"""
r_2 = r / (2 * (sin(a_oj)))
print(f"第二个圆的半径是{r_2}")
print((
solve([(x - a_x1) ** 2 + (y - a_y1) ** 2 - r_1 ** 2, (x - b_x1) ** 2 + (y - b_y1) ** 2 - r_2 ** 2],
x,
y)))
elif a_oj > a_ij and a_oj > a_oi:
x = Symbol('x')
y = Symbol('y')
m =
没有合适的资源?快使用搜索试试~ 我知道了~
2022数学建模国赛B题位无人机遂行编队飞行中的纯方位无源定位python代码.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共8个文件
py:8个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 119 浏览量
2024-08-15
19:20:25
上传
评论
收藏 6KB ZIP 举报
温馨提示
2022数学建模国赛B题位无人机遂行编队飞行中的纯方位无源定位python代码
资源推荐
资源详情
资源评论
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 8 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/8b9566d6b7ee402eb11b3ab031c6660f_fl1768317420.jpg!1)
FL1768317420
- 粉丝: 5964
- 资源: 6714
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)