425461%20MATLAB%20for%20Mechanical%20Engineering - PowerPoint PPT Presentation

About This Presentation
Title:

425461%20MATLAB%20for%20Mechanical%20Engineering

Description:

425461 MATLAB for Mechanical Engineering . . – PowerPoint PPT presentation

Number of Views:205
Avg rating:3.0/5.0
Slides: 25
Provided by: fav82
Category:

less

Transcript and Presenter's Notes

Title: 425461%20MATLAB%20for%20Mechanical%20Engineering


1
425461 MATLAB for Mechanical Engineering
  • ?. ???????????????????
  • ?. ????? ???????
  • Office Hour ??????, ???, ???????? 10.00 12.00
    ?.
  • Email soradak_at_g.sut.ac.th ???????? 044-224399

2
425461 MATLAB for Mechanical Engineering
  • ??????????????????
  • ?????????????????? MATLAB ?????????
    ???????????????????????????????? MATLAB
    ???????????? M ???????????????????????????????????
    ???????????????????????????????
    ???????????????????????????????????
    ??????????????????????????????????????????????????
    ???????????? ?????????????????????????????????????
    ?????????????????? ????????????
    ??????????????????????? ??????????????????????????
    ?????????????????????? MATLAB ????????????????????
    ?????????

3
425461 MATLAB for Mechanical Engineering
  • ??? ???? ????? ?????? ???? 17.00 - 20.00 ?.
    ???? CAD/CAM I (F5)
  • ??????????????????
  • ?????? MATLAB ????????????????? ??????? ?????
    ??????? ??? ?????? ????????????
  • ??????????????
  • 1 MATLAB ???????????????????????????
    ??????? ?????? ??????? ??????????
  • 2 ??????????????? MATLAB ???????????
    ??????? ???? ??????????, ??????? ??????????

4
???????????????
?????????? ???????/??????
1 Introduction to MATLAB
2 MATLAB useful function
3 Writing MATLAB Function and Scripts
4 Branch and loop programming Functions and
5 I/O and file manipulation
Mid-term Mid-term
5
???????????????
?????????? ???????/??????
6 MATLAB Graphics Part 1
7 MATLAB Graphics Part 1
8 Polynomials and Fitting
9 Numerical integration and differentiation
10 Symbolic Mathematics
11 MATLAB for engineering problem Part 1
12 MATLAB for engineering problem Part 2
Final Final
6
????????????
  • Class exam 20
  • Quiz 20
  • Mid-term 30
  • Final 30
  • ??? 100

7
??????????????????????? 1
  • Introduction to MATLAB
  • What is MATLAB?
  • Introduction for using MATLAB
  • Variable
  • Exercises

8
What is MATLAB?
  • The Language of Technological Computing
  • A very fancy calculator
  • A simple and user friendly programming language
  • A tool for data analysis and statistics
  • A tool to produce plots

9
Accessing MATLAB
10
Introduction for using MATLAB
11
The MATLAB Prompt
  • gtgt denotes where you type commands
  • Type or paste commands, then hit enter
  • If entering multiple commands, separate them by
    semicolon ()
  • Multiple commands may be on same line, as long as
    they are separated by semicolon ()
  • Ending a command with also tells MATLAB to not
    display the output
  • If want output displayed, do not use
  • gtgt22
  • ans
  • 4
  • gtgt

12
Variables
  • Variables are the basic building blocks
  • Capitalization matters, x not same as X
  • Matrix is a variable that contains multiple
    entries, i.e. V.98 1.02 .99 1.07
  • MATLAB is great with vectors and
    matrices,however, their orientation and size
    matter
  • You will get errors if try to add vectors of
    different size or different orientation

13
Basic Operations
  • Always use brackets to define matrices
  • Always use prentices ( ) to call values of
    matrices
  • The row is always first, the column is always
    second, i.e. M1(3,2) is not the same as M1(2,3)
  • To see which variables exist, use gtgtwhos
  • To delete variables, use gtgtclear x y
  • To find out size use gtgtsize(M1)

14
(No Transcript)
15
Elementary Algebra
  • Use , -, , / for basic operations
  • Use ./ and . for element by element operations
    on matrices and vectors
  • Use / and for matrix multiplication, but this
    only makes sense if youve taken Linear Algebra
  • Use to transpose a matrix
  • You can always multiply a matrix by a scalar
  • You can always overwrite old variables

16
(No Transcript)
17
(No Transcript)
18
Ranges of numbers
  • Colon specifies range of numbers
  • gtgtV315 sets V3 to be the numbers 1 through 5
  • gtgtV31313 sets V3 to be the numbers 1
    through 13, skipping every 3rd, note, it is
    transposed
  • gtgtM5M1(12,15) sets M5 to be all the numbers in
    rows 1-2 and columns 1-5 of M1
  • gtgtV3M1(,2) sets V3 to be the whole second
    column of M1

19
(No Transcript)
20
.m files
  • .m files are just text files
  • Do work in .m file
  • Paste work into Matlab prompt
  • Use to end lines
  • Save .m files
  • Use to add comments

21
Saving your work
  • gtgtsave workspace1 x y saves the variables x and
    y in a file called workspace1.mat
  • gtgtsave workspace1 saves all variables in
    workspace1.mat
  • gtgtload workspace1 loads the variables in
    workspace1.mat
  • gtgtclear all deletes all variables

22
Getting help
  • gtgthelp lists topic areas, for example one of
    these is graph2d
  • gtgthelp graph2d lists functions within graph2d,
    for example plot
  • gtgthelp plot gives help on plot

23
Functions we learned
  • General whos, clear, size, save
  • Matrix zeros, ones, whos
  • Math , -, , /,

24
Next week
  • MATLAB Useful function
Write a Comment
User Comments (0)
About PowerShow.com