I keep getting this error when I initialize my function!!
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
I keep getting this error when I initialize my function,
function dy = pendode2(t,y)
dy= zeros(2,1); % a column vector
A=110;
B=0.01;
C=0.001;
g=9.81;
L = (3*g)/(2*A);
omega=0.002;
% E=0.00011;
E=0.2;
d=80e-3;
h= d+(L*(1-cos(y(2))));
r= ((L*sin(y(2)))^2+(h)^2)^0.5;
dy(1)=A*sin(y(2))+B*sin(omega*t)-C*y(1)+cross( ((abs(y(2))/y(2)))*(E/r),cos( abs(y(2))+atan(-abs(h/L*sin(y(2))))));
dy(2)= y(1);
end
The error is as follows, "Error using pendode2 (line 13) Not enough input arguments."
where line 13 is, "h= d+(L*(1-cos(y(2))));"
I do not understand what's wrong with this line!
Furthermore, in another editor window,
options=odeset('RelTol',2.22045e-14,'AbsTol',[1e-14 1e-14]);
[t,y]=ode113(@pendode2, [0 1000], [0 0.2], options);
z1=diff(y(:,1));
z2=diff(y(:,2));
end
Returns an error:
Error in Simulator1 (line 2) [t,y]=ode113(@pendode2, [0 1000], [0 0.2], options);
PLEASE HELP.
1 个评论
Stephan
2018-10-13
There is nothing wrong with this line. If you call the function correctly:
res = pendode2(5,[1 1])
you get the cross product error like in the same question you already asked.
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!