2023高教社杯全国大学生数学建模竞赛B题代码解析

2023高教社杯全国大学生数学建模竞赛B题 多波束测线问题 代码解析

因为一些不可抗力,下面仅展示部分matlab代码(第一问的部分),其余代码看文末

x=70;
d=[-4	-3	-2	-1	0	1	2	3	4];
d=70 - 200 * tand(1.5) * d;

w = zeros(1,9);
eta = zeros(1,9);

x0 = [100 100 100 100 100];
options = optimoptions(@fsolve, 'MaxFunctionEvaluations', 10000, 'MaxIterations', 10000);

temp = fsolve(@root5d_1, x0, options);
w(1) = temp(5);
eta(1) = 1-200/w(1);

temp = fsolve(@root5d_2, x0, options);
w(2) = temp(5);
eta(2) = 1-200/w(2);


temp = fsolve(@root5d_3, x0, options);
w(3) = temp(5);
eta(3) = 1-200/w(3);


temp = fsolve(@root5d_4, x0, options);
w(4) = temp(5);
eta(4) = 1-200/w(4);


temp = fsolve(@root5d_5, x0, options);
w(5) = temp(5);
eta(5) = 1-200/w(5);

temp = fsolve(@root5d_6, x0, options);
w(6) = temp(5);
eta(6) = 1-200/w(6);

temp = fsolve(@root5d_7, x0, options);
w(7) = temp(5);
eta(7) = 1-200/w(7);

temp = fsolve(@root5d_8, x0, options);
w(8) = temp(5);
eta(8) = 1-200/w(8);

temp = fsolve(@root5d_9, x0, options);
w(9) = temp(5);
eta(9) = 1-200/w(9);

节选了部分:

function F = root5d_7(x)
theta=pi/3*2;alpha=1.5/180*pi;D1=59.5256313723252;
k0=cos(theta/2);k1=cos(theta);k2=cos(pi/2-(theta/2)-alpha);k3=cos(pi/2-(theta/2)+alpha);
F(1) = (x(1)).^2+D1*D1-2*k0*D1.*x(1)-(x(3)).^2;
F(2) = (x(1)).^2+(x(2)).^2-2*k1.*x(1).*x(2)-(x(5)).^2;
F(3) = (x(1)).^2+(x(3)).^2-2*k2.*x(1).*x(3)-D1*D1;
F(4) = (x(2)).^2+(x(4)).^2-2*k3.*x(2).*x(4)-D1*D1;
F(5) = x(4)+x(3)-x(5);


syms q w e r t
theta=120/180*pi;alpha=1.5/180*pi;D1=70;
k0=cos(theta/2);k1=cos(theta);k2=cos(pi/2-(theta/2)-alpha);k3=cos(pi/2-(theta/2)+alpha);
eqns = [0== (q).^2+D1.^2-2*k0*D1.*q-(e).^2,
        0 == (q).*2+(w).*2-2*k1*q.*w-(t).*2,
        0== (q).*2+(e).*2-2*k2*q.*e-D1*2,
        0== (w).*2+(r).*2-2*k3*w.*r-D1*2,
        0== r+e-t];

[q, w, e, r, t] = vpasolve(eqns, [q w e r t], [0,2000;0,2000;0,2000;1,2000;0,2000;])

有关思路、相关代码、讲解视频、参考文献等相关内容可以点击下方群名片哦!