MATLAB中写的m函数运行时总是出错,函数编写如下:

function x = compvel(u)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
% u(1)=omiga-2
% u(2)=theta-2
% u(3)=theta-3
r2=25.4;%曲柄长度
r3=101.6;%连杆长度

a=[r3*sin(u(3)) 1;-r3*cos(u(3)) 0];%系数矩阵
b=[-r2*u(1)*sin(u(2));r2*u(1)*cos(u(2))];
x=inv(a)*b;

在命令行输入 test=compevl(1:1:3)
提示:
Undefined function or method 'compevl' for input
arguments of type 'double'.
请问是怎么回事,我试着更改过保存路径,但还是这样

第1个回答  2014-04-13
gg = 1:1:3;

test=compevl(gg)