Академический Документы
Профессиональный Документы
Культура Документы
Introduction to Matlab
Matlab Basics
Branching Statements
Loops
User Defined Functions
Additional Data Types
Input/Output Functions
Simulink Toolbox
Important Toolboxes (if time is available)
Dr. Nidal Farhat
Mechanical Engineering Department
Objectives:
Ease of Use
Device-Independent Plotting
Matlab compiler
Disadvantages:
Interpreted programming language, slower than C++ and V. Fortran.
Mechanical Engineering Department
Command history
whos
Display the value of any variable in the
WS
clear var1 var2
Double-click any var in the WS browser
Mechanical Engineering Department
clf:
clear:
exits Matlab
!(command):
Sequence is
important
Power:
(^) or (.^)
a^b or a.^b
Multiplication:
(*) or (.*)
a*b or a.*b
Division:
(/) or (./)
a/b or a./b
(\) or (.\)
b\a or b.\a
or
NOTE:
56/8 = 8\56
Addition:
(+)
a+b
Subtraction:
(-)
ab
Assignment:
(=)
a=b
(assign b to a)
HW1
The distance traveled by a ball falling in the air is given by the equation
1 2
y y0 v0t at
2
Use the Matlab to plot the path of the ball (y) as a function of time from
t=0s to t=5s, if