# Finding equation of motion for a two mass one spring system

I'm trying to find the equation of motion for the system below.

As you see, there is a trailer connected to a car with a spring. There are a "b.v" force where b representing a coefficient of road and internal friction of vehicles. l is not written here, it is the length of the spring at equilibrium.

What I have done so far?

$$m_{1} \ddot{x_{1}} = u_{1} - b_{1} \dot{x_{1}} - k (x_{1} - x_{2} + l) - b_2 \dot{x_{2}}$$

$$m_{2} \ddot{x_{2}} = - k (x_{1} - x_{2} - l) - b_2 \dot{x_{2}}$$

I don't know if I'm on the right track, any help will be appreciated.

• strange that the force of friction depends on the velocity but not the mass of the car/trailer. Is that how the problem was set up, or is that your own idea? It is more reasonable to expect friction (even rolling friction) to scale with some size parameter (air drag would be quadratic in $v$ and linear in projected area, rolling friction might be independent of $v$ and linear in weight of the object). And I assume that $u_1$ is a force (based on how you use it in your first equation) - that's an unusual choice of letter ($F_1$ would be more typical). Commented Jan 2, 2016 at 20:53
• I think that there are a couple of problems with mix-ups here. First, if the equilibrium distance of the spring is "l" then when x1-x2=l or x1-x2-l=0 then the spring force should be zero. So there is a problem with the 1st equation's expression for spring force. Also, you don't have to explicitly include the road friction for vehicle #2 in the 1st equation, just the spring coupling to vehicle #2. Also, there are too many variables. You have two vehicles in motion, so you should be able to write everything in terms of x1, x2 and their derivatives. No need for a u1 in the first equation.
– user93237
Commented Jan 2, 2016 at 21:00
• @Floris actually it started as a basic cruise control system, then it got needed to be more complex. so I added a spring and a trailer. I will move forward to create a state-space representation, so letters are relevant to that.
– st.
Commented Jan 2, 2016 at 21:00
• A spring-loaded trailer will definitely make the control algorithm for a cruise control more challenging... but I contend you have not chosen your variables with sufficient care. In particular you need a different value $b$ for the drag on the two objects. And you need to define whether $U$ is a force, power, or something else. As I said - unconventional letters lead to confusion. Commented Jan 2, 2016 at 21:04
• Yes I guess it's a little confusing the way I named the variables. Sorry about that, I will change the FBD right away.
– st.
Commented Jan 2, 2016 at 21:07

I would write smth like this. The forces acting on the car are: $u_1, F_{friction}^{car}, F_{spring}$ and that is it. The forces acting on the trailer are: $F_{spring}, F_{friction}^{trailer}$, so the equations of motion are

$$m_{1} \ddot{x_{1}} = u_{1}-F_{friction}^{car}-F_{spring}$$ $$m_2 \ddot{x_{2}}=F_{spring}-F_{friction}^{trailer}.$$

According to your formulation of the problem, there are three forces acting on the car: $F_1$, the friction force and the spring force. The magnitude of the force exerted by the spring is given by $$|F_{spring}|=k|(x_1-x_2)-l|.$$ If $(x_1-x_2)>l$, the spring force will act on the car in the left direction according to your sketch. We can therefore write, assuming the $x$-axis points to the right, simply using Newton's law: $$m_1\ddot{x_1}=F_1-b_1\dot{x_1}-k(x_1-x_2-l)$$ On the other hand, there are two forces acting on the trailer: the friction force and the spring force, which will be in the direction opposite to the spring force acting on the car. Hence we get $$m_2\ddot{x_2}=-b_2\dot{x_2}+k(x_1-x_2-l)$$ and you have your equations of motion.

• Thank you, it's a little confusing when it's get to spring. Shouldn't I add the $l$ instead of subtracting it? As @SamuelWeir wrote up in the comments of original post, if $x1-x2 = l$ , then $x1-x2-l = 0$, spring force will be zero.
– st.
Commented Jan 2, 2016 at 21:34
• Well, I think that if $x_1-x_2=l$ then you have indeed a zero spring force. But due to the motion of the car the spring will be stretched again and you will again have a finite spring force and the trailer will therefore follow the car, after a certain response time. Commented Jan 2, 2016 at 21:40
• Actually, it makes no sense to add $l$, because the magnitude of the spring force would be $|F|=k|(x_1-x_2)+l|>0$ for all $x_1>x_2$, which would mean that there would be no equilibrium configuration for the spring. Commented Jan 2, 2016 at 21:47
• Thank you, it's more clear for me now. I will proceed this way.
– st.
Commented Jan 2, 2016 at 23:22