You are on page 1of 4

Chris Urbaniak

January 2005
(with reference to prior tutorials)
ME 360 MATLAB/SIMULINK Tutorial
MATLAB Overview:
- Matrix aboratory!
- "ne bi# calculator
- $u%erical with ability to &o sy%bolic
o Co%pare to Maple' (y%bolic with ability to &o nu%eric
- Use of toolboxes (co%%an&s) fro% %any &isciplines) inclu&in#'
o Controls
o *yna%ics
o +inancial syste%s
o (oft co%putin# (fu,,y lo#ic) #enetic al#orith%s) neural networks)
o "pti%i,ation
o -%a#e processin#
o .a&io fre/uencies
- 0bility to create your own functions
- (yntax is 1ery C-like
o 2xa%ples to follow (-MU-$3 o1er1iew
- help! function
- 4o sa1e files %ust set the path appropriately
o +ile -5 (et 6ath -5 0&& +ol&er
SIMULINK Overview:
- 7lock &ia#ra% %etho& of perfor%in# M0407 calculations an& si%ulations
- *ra# an& &rop blocks of 1arious types
o (ources
o (inks
o inear functions
- Connect blocks with lines
- Can nest blocks within each other
- 6erfor% si%ulations on syste%
- 0&apt si%ulation para%eters throu#h %enus
- 0l%ost any fiel& in any %enu or block %ay be set or rea& by M0407
- 4ricky part is knowin# where to fin& the blocks
8
SIMULINK Example:
89 :ettin# starte&
a! 0t the M0407 co%%an& line) type si%ulink!) or
"! Click on the (-MU-$3 toolbar icon
#! +ile $ew Mo&el
29 (i%ulation para%eters
a! (i%ulation Confi#uration 6ara%eters (ol1er
i9 (tart ti%e ; 0
ii9 (top ti%e ; 80
iii9 4ype ; +ixe& (tep
i19 (ol1er ; o&e<
19 (tep si,e ; 098
=9 (tep input
a! (i%ulink (ources (tep
"! (i%ulink (inks (cope
#! ink by &ra##in# line) or click on first ite% an& ctrl-click on secon&
$! 0&>ust line by #rabbin# corners
e! Chan#e block na%e by clickin# on text
%! *ouble-click block to access para%eters
&! .un si%ulation ((i%ulation .un) or click play! button)
'! ?iew output
i9 *ouble-click scope
ii9 .i#ht-click on axes to %anually set scale
iii9 Click binoculars to auto-scale axes
<9 (ine input
a! .eplace step! block with sine! block
i9 (i%ulink (ources (ine @a1e
"! .un si%ulation an& 1iew output
#! Aoo% in to peak of cur1e an& note resolution of cur1e
$! Chan#e step si,e to 0908 an& repeatB note resolution of cur1e
2
59 :ain
a! (i%ulink Co%%only Use& 7locks :ain
"! 0&>ust 1alue of #ain (&ouble-click on block)
#! .un si%ulationB co%pare %a#nitu&es to pre1ious si%ulation
C9 (u%%er
a! (i%ulink Co%%only Use& 7locks (u%
"! Chan#e step ti%e of secon& step to =
#! .un si%ulation
$! Chan#e si#n of su%%er by &ouble clickin#
i9 "r&er liste& is consistent with or&er on block
ii9 D! represents no si#n (blank space)
e! Chan#e one of the si#ns to a %inus an& si%ulate
E9 -nte#rator
a! (i%ulink Continuous -nte#rator
"! (et initial con&ition on inte#rator
#! (i%ulate
=
F9 +irst or&er syste%
a! (i%ulink Continuous 4ransfer +cn
"! Chan#e the para%eters of the nu%erator an& &eno%inator of the transfer function
G9 "utput to M0407
a! (i%ulink (inks 4o @orkspace
"! .ena%e 1ariable output fro% si%out! to &esire& (e9#9) x!)
#! ('a)&e ave %ormat to Arra*
$! Clear M0407 1ariables (type clear! at the M0407 co%%an& line)
e! .un si%ulation
%! 0t the M0407 co%%an& line) type the na%e of your 1ariable (e9#9) x!)
&! 0t the M0407 co%%an& line) type plot(x)!
'! +or %ore options) type help plot!
809 (uspension syste%
a! .oa& input u
"! Chassis &isplace%ent output y
#! 6ara%eters'
i9 Mass m ; <00 k#
ii9 (prin# stiffness k ; 800 000 $H%
iii9 *a%pin# coefficient b ; F000 $%s
$! -n aplace &o%ain'
2
bs k
y u
ms bs k
y Gu
+
=

+ +

=
e! Create an& si%ulate the %o&el
<

You might also like