Asked by chernet Deressa
on 10 Jun 2013

I am trying to simulate the following dynamic equation of a singular slider crank mechanism. I have changed the Dynamic equation to system of first order differential equations. I learnt that this system has no explicit and no implicit solution. Am now trying to get a numerical solution using ode solver 15s. ( I guess the system is stiff) But in running this in an m file i am told an error " undefined variable y2". In trying the one i pasted below you see that "Not enough input argument" Can any one help me way out of this problem please? I appreciate any kind of information.

Error using @(t,y1,y2,y3,y4)[y2;(sin(y1-y3)*y4^2+19.6*sin(y1))/(cos(y1)^2-2)-(cos(y1)*(9.8*sin(y3)-y2^2*sin(y1-y3)))/(cos(y1)^2-2)-((sin(y1)/(cos(y1)^2-2)-(cos(y1)*sin(y3))/(cos(y1)^2-2))*(-cos(y1)*y2^2-140*sin(y1)*y2-cos(y1)*y4^2-140*sin(y3)*y4+400*cos(y1)+400*cos(y3)+sin(y1)*(sin(y1)/(cos(y1)^2-2)-(cos(y1)*sin(y3))/(cos(y1)^2-2))+sin(y3)*((2*sin(y3))/(cos(y1)^2-2)-(cos(y1)*sin(y1))/(cos(y1)^2-2))))/(sin(y1)*(sin(y1)/(cos(y1)^2-2)-(cos(y1)*sin(y3))/(cos(y1)^2-2))+sin(y3)*((2*sin(y3))/(cos(y1)^2-2)-(cos(y1)*sin(y1))/(cos(y1)^2-2)));y4;(19.6*sin(y3)-2*y2^2*sin(y1-y3))/(cos(y1)^2-2)-(cos(y1)*(sin(y1-y3)*y4^2+19.6*sin(y1)))/(cos(y1)^2-2)-(((2*sin(y3))/(cos(y1)^2-2)-(cos(y1)*sin(y1))/(cos(y1)^2-2))*(-cos(y1)*y2^2-140*sin(y1)*y2-cos(y1)*y4^2-140*sin(y3)*y4+400*cos(y1)+400*cos(y3)+sin(y1)*(sin(y1)/(cos(y1)^2-2)-(cos(y1)*sin(y3))/(cos(y1)^2-2))+sin(y3)*((2*sin(y3))/(cos(y1)^2-2)-(cos(y1)*sin(y1))/(cos(y1)^2-2))))/(sin(y1)*(sin(y1)/(cos(y1)^2-2)-(cos(y1)*sin(y3)) /(cos(y1)^2-2))+sin(y3)*((2*sin(y3))/(cos(y1)^2-2)-(cos(y1)*sin(y1))/(cos(y1)^2-2)))] Not enough input arguments.

*No products are associated with this question.*

Opportunities for recent engineering grads.

## 1 Comment

## the cyclist (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78551#comment_154005

How are you calling that function? It works fine if I try