HOME
PDF

## HowTo, Matlab/Simulink for basic modeling

July 2, 2015 page compiled on July 2, 2015 at 12:03am

Solve with

Solve with

Solve with

### 4 How to solve second order ode with non-zero initial conditions?

Solve with

The initial conditions are set up by modifying the integator block as shown below.

### 5 How to solve mass/spring system with unit step input?

From HW problem I did for ECE 717, to be solved using Simulink

Starting with the assumption that the ground surface is smooth and there is no friction. Assuming that all parts are moving in the positive direction to the right. Taking a snap shot when so that the spring is in compression. Spring is in compression by also assuming that at this instance.

Any other assumptions will also lead to the same set of equations as long as they are used in consistent way when ﬁnding the forces in the springs.

Starting with drawing a free body diagram of each body showing all forces acting on them based on the above assumption, and then using to ﬁnd the equation of motion of each body . The free body diagrams is shown below

Now is applied to each body to obtain the equation of motions. For mass

And for mass

Now the state space equations are found.

Hence

The above is in the form of and where is number of outputs, is the number of input and is the number of states.

Using and now the unit step response for is found using Simulink. With the above values the system becomes

Using simulink, state space block was used to implement the above. A step input source was used. Demux was used to send the and responses to two diﬀerent time scopes. Simulation was set for 40 seconds to obtain long enough view of the response. The following ﬁgure shows the step response and the model used.