matlab提示Error evaluating MATLAB function,Undefined command/function
写了一小段函数程序,嵌入在simulink的matlab function模块中,给了输入变量矩阵初值后,运行,matlab老提示错误:Error evaluating MATLAB function in 'simemechanic/MATLAB Fcn1'. MATLAB error message:Undefined command/function 'comperr.m',找了几本书也不知道哪里错了,恳请高手指点,万分感谢。
function [e]=comperr(u)
%u(1)=f1;
%u(2)=theta2;
%u(3)=s3;
r1=100;
r2=300;
r3=30;
ex=r1*cos(u(1))+r2*cos(u(2))-u3;
ey=r1*sin(u(1))+r2*sin(u(2))-r3;
e=norm([ex,ey]);