完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛扫一扫,分享给好友
|
|
|
相关推荐
1个回答
|
|
|
用逐点比较插补法插补第一象限的直线OA,O点为原点,A点坐标为 (8,6),请完成以下任务:
(1)列出插补计算过程; (2)画出插补轨迹图。 import numpy as np from matplotlib import pyplot as plt #确定第一象限直线 line = [[0, 8], [0, 6]] plt.title("point-by-point relative method") plt.xlabel("X") plt.ylabel("Y") plt.plot(line[0],line[1]) plt.scatter(line[0], line[1], color='Red') plt.show() #计算出总共节拍 Nxy =abs((line[0][1]-line[0][0]))+abs((line[1][1]-line[1][0])) print(Nxy) Output:14 #F作为判别函数,S和E代表偏差与坐标值计算时候的xy轴 F = 0 S = [0,0] E = [0,0] print(end= "SteptDiscriminant functiont") print(end= "Feed functiontDeviation and coordinate value calculationt") print(end= "End pointn") for i in range(0, Nxy): print(end = "{}t".format(i+1)) #判段判别函数,分别得出进给方向,偏差与坐标值计算 if F >= 0: print(end = "F >= 0ttt+Xtt") F = F - line[1][1] print(end = "F = {}tttttt".format(F)) S[1] = S[1] + 1 plt.plot(S,E) plt.scatter(S,E, color='b') S[0] = S[1] print(end = "{}n".format(Nxy - i)) continue if F < 0: print(end = "F < 0ttt+Ytt") F = F + line[0][1] print(end = "F = {}tttttt".format(F)) E[1] = E[1] + 1 plt.plot(S,E) plt.scatter(S,E, color='b') E[0] = E[1] print(end = "{}n".format(Nxy - i)) continue #进行图像打印 plt.plot(line[0],line[1]) plt.scatter(line[0], line[1], color='Red') plt.grid(color = 'gray') plt.show() Step Discriminant function Feed function Deviation and coordinate value calculation End point 1 F >= 0 +X F = -6 14 2 F < 0 +Y F = 2 13 3 F >= 0 +X F = -4 12 4 F < 0 +Y F = 4 11 5 F >= 0 +X F = -2 10 6 F < 0 +Y F = 6 9 7 F >= 0 +X F = 0 8 8 F >= 0 +X F = -6 7 9 F < 0 +Y F = 2 6 10 F >= 0 +X F = -4 5 11 F < 0 +Y F = 4 4 12 F >= 0 +X F = -2 3 13 F < 0 +Y F = 6 2 14 F >= 0 +X F = 0 1 ———————————————— |
|
|
|
|
只有小组成员才能发言,加入小组>>
3091 浏览 0 评论
10850 浏览 4 评论
39067 浏览 19 评论
5854 浏览 0 评论
27605 浏览 34 评论
1657浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-18 04:22 , Processed in 1.107880 second(s), Total 72, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4266