[求助]紧急 :计算飞机航程程序错在哪里的问题
function totaldistancepp=[40,116;
31,122;
36,140;
37,-123;
41,-76];
totald=distance([pp(1),:])++distance([pp(2),:])+...
+distance([pp(3),:])+distance([pp(4),:]);
disp('total distance:');
disp(totald);
function d=distance(p1,p2)
R=6400+10;
p1=trans(R,p1(1),p1(2));
p2=trans(R,p2(1),p2(2));
d=R*acos(p1*p2'/R^2);
function p=trans(R,theta,fai)
R=6400+10;
theta=theta*pi/180;
fai=fai*pi/180;
x=R*cos(theta)*cos(fai);
y=R*cos(theta)*sin(fai);
z=R*sin(theta);
p=[x,y,z];
谢谢指点!!