HOME

PDF (letter size)

Simulink files to download

  1. project_step.mdl
  2. project_sin.mdl
  3. project_impulse.mdl
  4. project.mdl

Using Simulink to analyze two degrees of freedom system

Nasser M. Abbasi

Spring 2009   Compiled on January 31, 2024 at 3:47am

Abstract

A two degrees of freedom system consisting of two masses connected by springs and subject to 3 different type of input forces is analyzed and simulated using Simulink

Contents

1 Introduction and Theory
2 Analytical solution
2.1 Finding the homogenous solution
2.2 Finding particular solutions
2.2.1 Finding the particular solution for unit impulse input
2.2.2 Finding the particular solution for unit step input
2.2.3 Finding the particular solution for sinωt
3 Simulink simulation and block diagrams
3.1 Unit step simulink diagram and output
3.1.1 Verification of result from Simulink by Numerically solving the differential equations
4 Unit impulse simulink diagram and output
4.0.1 Verification of result from Simulink by Numerically solving the differential equations
4.1 sin(ωt) input simulink diagram and output
5 Discussion

1 Introduction and Theory

The system that is being analyzed is show in the following diagram

In the above, F(t) is to be taken as each of the following

  1. Unit impulse force.
  2. Unit step force.
  3. sinωt

It is required to find x1(t) and x2(t) analytically and then to use Matlab’s Simulink software for the analysis.

The mathematical model of the system is first developed and the equation of motions obtained using Lagrangian formulation then the analytical solution is found by solving the resulting coupled second order differential equations for m1 and m2. Next, a simulink model is developed to implement the differential equations and the output x1(t) and x2(t) from Simulink is shown and compared to the output from the analytical solution.

2 Analytical solution

The following is the free body diagram of the above system

Assuming positive is downwards and that x2>x1, force-balance equations for m1 results inm1x¨1=F(t)+k1(x2x1) And force-balance equations for m2 results inm2x¨2=k1(x2x1)k2x2 Hence the EQM for the system becomem1x¨1k1x2+k1x1=F(t)m2x¨2+(k1+k2)x2k1x1=0

Or in matrix form(m100m2)(x¨1x¨2)+(k1k1k1(k1+k2))(x1x2)=(F(t)0) The above can be written in matrix form asMx¨+Kx=F Where x¨,x,F are 2 by 1 vectors and M and K are the mass and stiffness matrices. The solution to the above is (1)x=xh+xp

2.1 Finding the homogenous solution

We start by finding xh from the following(m100m2)(x¨1x¨2)+(k1k1k1(k1+k2))(x1x2)=(00) Assuming that x1(t)=A1cos(ωt+ϕ) and x2(t)=A2cos(ωt+ϕ), hence x˙1(t)=ωA1sin(ωt+ϕ) and x˙2(t)=ωA2sin(ωt+ϕ) and x¨1(t)=ω2A1cos(ωt+ϕ) and x˙2(t)=ω2A2cos(ωt+ϕ). Substituting the above values in the above system results in(m100m2)(ω2A1cos(ωt+ϕ)ω2A2cos(ωt+ϕ))+(k1k1k1(k1+k2))(A1cos(ωt+ϕ)A2cos(ωt+ϕ))=(00) Divide by cos(ωt+ϕ) since not zero (else no solution exist) we obtain(m100m2)(ω2A1ω2A2)+(k1k1k1(k1+k2))(A1A2)=(00) Rewrite the above as(ω2m1A1ω2m2A2)+(k1A1k1A2k1A1+(k1+k2)A2)=(00)(ω2m1A1+k1A1k1A2ω2m2A2k1A1+(k1+k2)A2)=(00)((ω2m1+k1)A1k1A2ω2m2A2+(k1+k2)A2k1A1)=(00)(2)(ω2m1+k1k1k1ω2m2+(k1+k2))(A1A2)=(00)

From the last equation above, we see that to obtain a solution we must have |ω2m1+k1k1k1ω2m2+(k1+k2)|=0 since if we had (A1A2)=0 then no solution will exist. Therefore, taking the determinant and setting it to zero results in

(ω2m1+k1)(ω2m2+(k1+k2))k12=0k12+k1k2ω2k1m1ω2k1m2ω2k2m1+ω4m1m2k12=0ω4m1m2+ω2(k1m1k2m1k1m2)+(k12+k1k2k12)=0

Let ω4=λ2, hence the above becomesλ2m1m2+λ(k1m1k2m1k1m2)+(k12+k1k2k12)=0 Solving for λ gives(3)λ1=12m1m2(k1m1+k1m2+k2m1+k12m12+k12m22+k22m12+2k1k2m12+2k12m1m22k1k2m1m2)λ2=12m1m2(k1m1+k1m2+k2m1k12m12+k12m22+k22m12+2k1k2m12+2k12m1m22k1k2m1m2) For each of the above solutions, we obtain a different (A1A2) from equation (2) as follows

For λ1, (2) becomes(λ1m1+k1k1k1λ1m2+(k1+k2))(A1A2)=(00)((λ1m1+k1)A1k1A2k1A1λ1m2A2+(k1+k2)A2)=(00)

From the first equation above, we have(λ1m1+k1)A1k1A2=0λ1m1+k1k1=(A2A1)(1)

Similarly for λ2, λ2m1+k1k1=(A2A1)(2) Let(4)r1=λ1m1+k1k1=(A2A1)(1)r2=λ2m1+k1k1=(A2A1)(2)

Hence now xh can be written as(x1x2)h=(A1(1)cos(ω1t+ϕ1)+A1(2)cos(ω2t+ϕ2)A2(1)cos(ω1t+ϕ1)+A2(2)cos(ω2t+ϕ2)) But A2(1)=r1A1(1) and A2(2)=r2A1(2), hence the above becomes(5)(x1x2)h=(A1(1)cos(ω1t+ϕ1)+A1(2)cos(ω2t+ϕ2)r1A1(1)cos(ω1t+ϕ1)+r2A1(2)cos(ω2t+ϕ2)) Now, given numerical values for k1,k2,m1,m2 we can find ω1,ω2 from (3) above, and next find r1,r2 from (4).  Hence (5) contains 4 unknowns, A1(1),A1(2),ϕ1,ϕ2 which now can be found from initial conditions (after we find the particular solution) which we will now proceed to do.

2.2 Finding particular solutions

There are 3 different F(t) which we are asked to consider

  1. Unit impulse force.
  2. Unit step force.
  3. sinωt

For each of the above, we find xp and then add it to xh found above in (5) to obtain (1).

2.2.1 Finding the particular solution for unit impulse input

Using the standard response for a unit impulse which for a single degree of freedom system is x(t)=1mωnsinωnt, then we write xp asxp=(x1x2)p=(1mω1sinω1t+1mω2sinω2t0) Hence, the general solution becomes(6)(x1x2)=(A1(1)cos(ω1t+ϕ1)+A1(2)cos(ω2t+ϕ2)r1A1(1)cos(ω1t+ϕ1)+r2A1(2)cos(ω2t+ϕ2))+(1mω1sinω1t+1mω2sinω2t0)

2.2.2 Finding the particular solution for unit step input

Since unit step is 1 for t>0, then, using convolution we writexp(t)=0tf(τ)h(tτ)dτ=0th(tτ)dτ=0t1mωnsinωn(tτ)dτ=1mωn[cos(ωn(tτ))ωn]0t=1mωn2[cos(ωn(tτ))]0t=1mωn2[1cos(ωnt)]

Then, since now we have 2 natural frequencies, we can write xp asxp=(x1x2)p=(1mω12[1cos(ω1t)]+1mω22[1cos(ω2t)]0) Hence, the general solution becomes(x1x2)=(A1(1)cos(ω1t+ϕ1)+A1(2)cos(ω2t+ϕ2)r1A1(1)cos(ω1t+ϕ1)+r2A1(2)cos(ω2t+ϕ2))+(1mω12[1cos(ω1t)]+1mω22[1cos(ω2t)]0)

2.2.3 Finding the particular solution for sinωt

In this case, we guess that x1p=c1cosωt+c2sinωt, and since there is no forcing function being applied directly on m2 then x2p=0 hencexp=(x1(t)x2(t))p=(c1cosωt+c2sinωt0) Then x˙1p(t)=ωc1sinωt+ωc2cosωt and x¨1p(t)=ω2c1cosωt+ω2c2sinωt and now we substitute these into the original ODE for x1 which ism1x¨1k1x2+k1x1=F(t)m1x¨1pk1x2p+k1x1p=sinωt

We obtain the followingm1(ω2c1cosωt+ω2c2sinωt)k1(0)+k1(c1cosωt+c2sinωt)=sinωtcosωt(ω2c1m1+k1c1)+sinωt(m1ω2c2+k1c2)=sinωt

Hence by comparing coefficients, we obtainω2c1m1+k1c1=0m1ω2c2+k1c2=1

orc1(ω2m1+k1)=0c2(m1ω2+k1)=1

c1 must be zero since k1ω2m1=0 only when ω=ωn and we assume that this is not the case here. Hencec1=0c2=1(m1ω2+k1)

Therefore xp becomesxp=(x1(t)x2(t))p=(1(m1ω2+k1)sinωt0) And the general solution becomes(8)(x1x2)=(A1(1)cos(ω1t+ϕ1)+A1(2)cos(ω2t+ϕ2)r1A1(1)cos(ω1t+ϕ1)+r2A1(2)cos(ω2t+ϕ2))+(1(m1ω2+k1)sinωt0)

In simulink, we will directly solve the system from the original formulationm1x¨1k1x2+k1x1=F(t)m2x¨2+(k1+k2)x2k1x1=0

orx¨1k1m1x2+k1m1x1=F(t)m1x¨2+(k1+k2)m2x2k1m2x1=0

Hencex¨1=F(t)m1+k1m1x2k1m1x1x¨2=(k1+k2)m2x2+k1m2x1

The simulink block diagram will be as follows for the unit step input

For an initial run with parameters m1=m2=k1=k2=1 I get this warning below

EDU>> simulink 
Warning: Using a default value of 0.2 for maximum step size.  The simulation 
step size will be equal to or less than this value.  You can disable this 
diagnostic by setting 'Automatic solver parameter selection' diagnostic to 
'none' in the Diagnostics page of the configuration parameters dialog.
 

And this is the output for x1(t) and x2(t) for the unit step response

To verify the above output from Simulink, I solved the same coupled differential equations for zero initial conditions numerically (using a numerical differential equation solver) and plotted the solution for x1(t) and x2(t) and the result matches that shown above by simulink. Here is the code the plot as a result of this verification

And the output for x1(t) and x2(t) is as follows

To verify the above output from Simulink, The same coupled differential equations were solved numerically for zero initial conditions numerically and the solution plotted for x1(t) and x2(t) and the result was found to match that shown above by simulink. Here is the code used to do the verification.

The simulink block diagram will be as follows for the sinωt input

For an initial run with parameters m1=m2=k1=k2=1 this is the output for x1(t) and x2(t) and showing the input signal at the same time

5 Discussion

A coupled system of two masses and springs was analyzed using Simulink. The simulation was done for one set of parameters (masses and stiffness). Simulink made the simulation of this system under different loading conditions easy to do. The 2 masses response were recorded using simulink scope and the signals captured on the same plot to make it easy to compare the response of the first mass to the second mass.

The analytical analysis was more time consuming than actually making the simulation in simulink. The ability to easily change different sources to the system was useful as well as the ability to change the frequency of the input and immediately see the effect on the response.

This was my first project using Simulink, and I can see that this tool will be useful to learn more as it allows one to easily analyze engineering problems.