代码拉取完成,页面将自动刷新
syms k
t = 0:0.1:2*pi;
r = 2;
res = [];
xpos = [];
rd = 6:1:20;
x = r*cos(t);
y = r*sin(t);
amx = [];
ag = [];
% x采样点
sx = xc+r;
for xc = rd
x1 = r*cos(t)+xc;
y2 = r*sin(t)+yc;
xpos = [];
res = [];
for j = t
xi = r*cos(j);
yi = r*sin(j);
result = solve(abs(k*xc-yc-k*xi+yi)/sqrt(k^2+1)==2);
tmp = real(result);
g = double(tmp(tmp~=0));
grad1 = g(1);
grad2 = g(2);
if abs(grad1) < grad2
g1 = -grad2;
g2 = grad2;
else
g1 = grad1;
g2 = abs(grad1);
end
xpos = [xpos xi];
res = [res abs(atand(g1) - atand(g2))];
end
[~,idx] = max(res);
mx = xpos(idx);
qx = r*2*r/xc;
ag = [ag qx];
amx = [ amx mx];
end
figure()
plot(amx,'or')
hold on
plot(ag)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。