matlab Error:Missing variable or function.请大家帮我看看刚学MATLAB 许多都不懂程序如下:function D=distance(p1,p2);R=6400;u1=p1(1)*pi/180;u2=p2(1)*pi/180;v1=p1(2)*pi/180;v2=p2(2)*180/pi;x1=R*cos(u1)*cos(v1);y1=R*cos(u1)*sin(v1);z1=R
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 06:57:00
matlab Error:Missing variable or function.请大家帮我看看刚学MATLAB 许多都不懂程序如下:function D=distance(p1,p2);R=6400;u1=p1(1)*pi/180;u2=p2(1)*pi/180;v1=p1(2)*pi/180;v2=p2(2)*180/pi;x1=R*cos(u1)*cos(v1);y1=R*cos(u1)*sin(v1);z1=R
matlab Error:Missing variable or function.请大家帮我看看
刚学MATLAB 许多都不懂
程序如下:
function D=distance(p1,p2);
R=6400;
u1=p1(1)*pi/180;u2=p2(1)*pi/180;
v1=p1(2)*pi/180;v2=p2(2)*180/pi;
x1=R*cos(u1)*cos(v1);y1=R*cos(u1)*sin(v1);z1=R*sin(u1);
x2=R*cos(u2)*cos(v2);y2=R*cos(u2)*sin(v2);z2=R*sin(u2);
op1=[x1,y1,z1];op2=[x2,y2,z2];
D=R*acos(op1*op2'/R^2);
p1=[40,118];p2=[41,-76];
L=distance(p1,p2)
运行提示
Error:Missing variable or function.
请问是哪里出错了呢?
matlab Error:Missing variable or function.请大家帮我看看刚学MATLAB 许多都不懂程序如下:function D=distance(p1,p2);R=6400;u1=p1(1)*pi/180;u2=p2(1)*pi/180;v1=p1(2)*pi/180;v2=p2(2)*180/pi;x1=R*cos(u1)*cos(v1);y1=R*cos(u1)*sin(v1);z1=R
distance应该不是matlab内置的函数吧,你的函数体是不是缺少了