函数程序是
function out=rampslider(u)
%
% function to compute accelerations of the slider
% on an inclined plane with friction
%
% Author: J.F. Gardner
%
% Copyright 2001
%
% u(1) = x-dot
% u(2) = y-dot
%
m = 1.0; % kg
gamma = 30 *pi/180; % radians
mu = 0.5;
g = 9.8687;
%
% compute the down-ramp velocity to find direction
% of friction force
%%
sdot=u(1)*cos(gamma)-u(2)*sin(gamma);
%
if sdot> 0
sigma = 1.0;
else
sigma = -1.0;
end
%
a=[m 0 sigma*mu*cos(gamma)-sin(gamma) ;
0 m -(sigma*mu*sin(gamma)+cos(gamma)) ;
tan(gamma) 1 0];
%
b=[0;-m*g;0];
%
out=inv(a)*b;
出错代码是
Error in 'untitled/rampslider.m ' while evaluating expression: The function, script, or class rampslider
cannot be indexed using {} or . indexing
我是用simulink仿真,老调试不出
追答似乎没有输入吧?
追问什么输入
追答一个系统有输入有输出,得有初始的激励才能产生响应吧?你这个系统只让他的输出作为他的输入,但是得有一个起点让他有输出啊