matlab运行错误function f=EX83fun(x)tryOax=-30;Oay=20;L1=x(1);L2=x(2);L3=x(3);L0=x(4);alpha=(x(5)/180)*pi;L4=x(6);beta=(x(7)/180)*pi;phi1=[0,x(9),x(10),x(11),120,150,180,210,240,270,300,330];phi=((phi1+x(8))/180)*pi;PBx=[44.9,28.6,6.4,-17.4,-37.8,
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 17:55:19
matlab运行错误function f=EX83fun(x)tryOax=-30;Oay=20;L1=x(1);L2=x(2);L3=x(3);L0=x(4);alpha=(x(5)/180)*pi;L4=x(6);beta=(x(7)/180)*pi;phi1=[0,x(9),x(10),x(11),120,150,180,210,240,270,300,330];phi=((phi1+x(8))/180)*pi;PBx=[44.9,28.6,6.4,-17.4,-37.8,
matlab运行错误
function f=EX83fun(x)
try
Oax=-30;Oay=20;
L1=x(1);L2=x(2);L3=x(3);L0=x(4);
alpha=(x(5)/180)*pi;L4=x(6);beta=(x(7)/180)*pi;
phi1=[0,x(9),x(10),x(11),120,150,180,210,240,270,300,330];
phi=((phi1+x(8))/180)*pi;
PBx=[44.9,28.6,6.4,-17.4,-37.8,-48.9,-48.3,-34.6,-9.2,21.1,43.7,50.7];
PBy=[46.5,63.9,72.5,70.4,58.1,41.5,23.9,8.7,0.5,-1.2,6.6,24.6];
for j=1:12
E=L0*cos(alpha)-L1*cos(phi1(j));
F=L0*sin(alpha)-L1*sin(phi1(j));
G=(E*E+F*F+L3*L3-L2*L2)/(2*L3);
if(E*E+F*F-G*G)
matlab运行错误function f=EX83fun(x)tryOax=-30;Oay=20;L1=x(1);L2=x(2);L3=x(3);L0=x(4);alpha=(x(5)/180)*pi;L4=x(6);beta=(x(7)/180)*pi;phi1=[0,x(9),x(10),x(11),120,150,180,210,240,270,300,330];phi=((phi1+x(8))/180)*pi;PBx=[44.9,28.6,6.4,-17.4,-37.8,
程序第14行,end前使用了中文标点“,”
16行左括弧,19行最后一个右括弧,都是中文的括弧,Matlab不认的.
另外for要以end来结尾,if else end是一个整体.你自己检查检查吧.
以下是修正以上语法错误的程序:
function f=EX83fun(x)
try
Oax=-30;Oay=20;
L1=x(1);L2=x(2);L3=x(3);L0=x(4);
alpha=(x(5)/180)*pi;L4=x(6);beta=(x(7)/180)*pi;
phi1=[0,x(9),x(10),x(11),120,150,180,210,240,270,300,330];
phi=((phi1+x(8))/180)*pi;
PBx=[44.9,28.6,6.4,-17.4,-37.8,-48.9,-48.3,-34.6,-9.2,21.1,43.7,50.7];
PBy=[46.5,63.9,72.5,70.4,58.1,41.5,23.9,8.7,0.5,-1.2,6.6,24.6];
for j=1:12
E=L0*cos(alpha)-L1*cos(phi1(j));
F=L0*sin(alpha)-L1*sin(phi1(j));
G=(E*E+F*F+L3*L3-L2*L2)/(2*L3);
if(E*E+F*F-G*G)