im mufeed al-turk, im studying electrical engineering in jordan, i want to present important subject in this forum, it’s modeling the systems and simulation using matlab, i start by an example about this subject, i want from everyone try to analayze any system that he wants and makes simulation for it
simple spring - mass
![](http://www.me.cmu.edu/ctms/modeling/tutorial/overview/secondordersetup.jpg)
the previous fiqure displays a mass is attatched with asping on a rough surface , first we draw free body diagram to know variables and constants in the system ,
![](http://www.me.cmu.edu/ctms/modeling/tutorial/freebodydiagram/secondorderfbd.jpg)
we can from the previous figure to extract wuation the we build up the simulation on it .
by newton’s law
f(t)=ma+Bv+Kx
where :
m: mass, B: frictional constant , K: spring constant
a: acceleration , x: displacement , v: velocity , f(t): external force
a=d^2x/dt^2 , v=dx/dt
so the equation will be :
f(t)=md^2x/dt^2 +Bdx/dt+Kx ,
now the simulation this model is :
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten42.jpg)
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten43.jpg)
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten44.jpg)
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten45.jpg)
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten46.jpg)
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten47.jpg)
notes:
1-we get gain from simulink library , used blocks
2-we get integrator from simulink library , continuos
3- we click double click on each block if we want to change its parameters
4-we get summation block from simulink library , used blocks
5- if we change the signs of summation block we will double click on it
6-it’s very easy to connect between blocks by mouse.
7- we get a signal from simulink library , sources for the external force
we want to get step function as mentioned in the foloowing fogure
then we enter the parameters of the gain m , b ,k in the command window as
m=2; b=5; k=3;
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten48.jpg)
we usualy use scope to show the respone of the system and we get it from simulink library , sinks
![](http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/conten50.jpg)
then play the model from the abpve sign in the window like the movie player
Eng. mufeed al-turk
2008