1 MATLAB 입문 An Overview of MATLAB. An Overview of MATLAB 2 Starting Matlab The default MATLAB Desktop.

Slides:



Advertisements
Similar presentations
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Advertisements

Introduction to MATLAB
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB.
Introduction to MATLAB 7
Introduction to MATLAB 7 for Engineers
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
January 24, 2005 Lecture 3 - By P. Lin 1 CPET 190 Lecture 3 Problem Solving with MATLAB
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Chapter 1 An Overview Of MATLAB. The default MATLAB Desktop. Figure 1.1–1 1-2 More? See pages 6-7.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Copyright © The McGraw-Hill Companies, Inc. Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 1 An Overview of MATLAB.
Introduction to Matlab Module #1 Page 1 Introduction to Matlab Module #1 – Getting Started with Matlab Topics 1.Starting a session 2.Entering commands.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
A Brief introduction to MatLAB ($50 - $99 for students)
Chapter 1 An Overview Of MATLAB. The default MATLAB Desktop. Figure 1.1–1 1-2 More? See pages 6-7.
MATLAB Technical Computing Environment. MATLAB Matlab is an interactive computing environment that enables numerical computation and data visualization.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to MATLAB. CSPP58001 MATLAB MATLAB is is a matrix-based language well suited for carrying out numerical analysis. It has many, many high-
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB Lecture 18.
A simple classification problem Extract attributes Pattern Pattern recognition decision x C1 C2.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
Fundamentals of Programming 20-ENFD-112 Sections 001 to 007 Instructor: Prof. Dieter Schmidt Lecture: Monday, Wednesday 3:00-3:50 Web page
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
BASICS OF MATLAB Engr.Mian Shahzad Iqbal Lecturer,Telecom Department University of Engineering & Technology Taxila.
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
MATLAB The name of MATLAB stands for matrix laboratory. Starting a MATLAB Session -On Microsoft® Windows® platforms, start the MATLAB program by double-clicking.
ECE 1304 Introduction to Electrical and Computer Engineering
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to MATLAB for Engineers, Third Edition
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
MATLAB PRIMER by Michael Medvinsky(2014)
StatLab Matlab Workshop
Use of Mathematics using Technology (Maltlab)
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Digital Image Processing
Simulation And Modelling
INTRODUCTION TO MATLAB
Introduction to MATLAB 7
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
How to Use MATLAB A Brief Introduction.
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
MatLab Program Used to Calculate Interactive
Presentation transcript:

1 MATLAB 입문 An Overview of MATLAB

An Overview of MATLAB 2 Starting Matlab The default MATLAB Desktop.

An Overview of MATLAB 3 Operations (1/2) SymbolOperationMATLAB form ^exponentiation:a^b *multiplication:a*b /right division:a/b \left division:a\b +addition:a+b -subtraction:a-b Scalar arithmetic operations

An Overview of MATLAB 4 Operations (2/2)

An Overview of MATLAB 5 assignment, workspace, and command The sign ‘=‘ is called the ‘assignment or replacement’ operator.  e.g. x = 3 : assign the value 3 to the variable x x = x + 2 : add 2 to the current value of x Workspace : the names and values of any variables in use in the current work session Commands for managing the work session clc clears the Command window clear Removes all variables from memory exist(‘name’) Determines if a file or variable exists having the name ’name’ quit Stops MATLAB who Lists the variable currently in memory whos Lists the current variables and sizes, and indicates if they have imaginary parts : Colon; generates and array having regularly spaced elements, Comma; separates elements of an array ; Semicolon; suppresses screen printing; also denotes a new row in an array … Ellipsis; continues a line

An Overview of MATLAB 6 recall feature, and special variable recall feature  recall a previously typed function or variable  e.g. up-arrow key(↑) & down-arrow key(↓): move up and down through the previously typed lines one line at a time. Tab key: automatically completes the name of a function, variable, or file if you type the first few letters of the name and press the Tab key. Special variables and constants ans Temporary variable containing the most recent answer eps Specifies the accuracy of floating point precision i, j The imaginary unit Inf Infinity NaN Indicates an undefined numerical result pi The number π

An Overview of MATLAB 7 Complex Number Operations

An Overview of MATLAB 8 Formatting Commands The Format command controls how numbers appear on the screen. format short Four decimal digits (the default); format long 16 digits; format short e Five digits (four decimals) plus exponent; e+03 format long e 16 digits (15 decimals) plus exponent; e-04 format bank Two decimal digits; format + Positive, negative, or zero; + format rat Rational approximation; 43/7 format compact Suppresses some line feeds format loose Resets to less compact display mode

An Overview of MATLAB 9 Array(1/2) One of the strengths of MATLAB is its ability to handle collections of numbers, called arrays. A numerical array is an ordered collection of numbers We can use square brackets  e.g. >> x = [0, 1, 3, 6] You need not type all the numbers in the array if they are regularly spaced  e.g. >> u = [0: 0.1: 10]  u = [0, 0.1, 0.2, 0.3, …, 9.8, 9.9, 10]

An Overview of MATLAB 10 Array(2/2) You can compute ‘w=5*sin (u)’ for ‘u=[0: 0.1: 10]’ >> u=[0: 0.1: 10]; >> w=5*sin(u);  computed the formula ‘w=5*sin(u)’ 101 times. array index: points to a particular element in the array >>u(7) ans = >>w(7) ans = length: determine how many values are in an array >>m = length(w) m = 101

An Overview of MATLAB 11 Mathematical functions Some commonly used mathematical functions FunctionMATLAB syntax ( ◈ ) exp(x) sqrt(x) log(x) log10(x) cos(x) sin(x) tan(x) acos(x) asin(x) atan(x) ◈ The MATLAB trigonometric functions use radian measure

An Overview of MATLAB 12 Working with Files M-file: MATLAB function files and program files are saved with the extension.m, and called M-files. MAT-file: save the names and values of variables. ASCII-file: files written in a specific format designed to make them usable to a wide variety of software.

An Overview of MATLAB 13 System, directory, and file commands system, directory, and file commands addpath dirname Adds the directory dirname to the search path. cd dirname Changes the current directory to dirname. dir Lists all files in the current directory. dir dirname Lists all the files in the directory dirname. path Displays the MATLAB search path. pathtool Starts the Set Path tool. pwd Displays the current directory. rmpath dirname Removes the directory dirname from the search path. what Lists the MATLAB-specific files found in the current working directory. Most data files and other non-MATLAB files are not listed. Use dir to get a list of all files. what dirname Lists the MATLAB-specific files in directory dirname.

An Overview of MATLAB 14 Plotting commands Some MATLAB plotting commands [x, y] = ginput(n) Enables the mouse to get n points from a plot, and returns the x and y coordinates in the vectors x and y, which have a length n. grid puts grid lines on the plot. gtext (‘text’) Enables placement of text with the mouse. plot (x, y) Generates a plot of the array y versus the array x on rectilinear axes. title (‘text’) Puts text in a title at the top of the plot. xlabel (‘text’) Adds a text label to the horizontal axis (the abscissa). ylabel (‘text’) Adds a text label to the vertical axis (the ordinate).

An Overview of MATLAB 15 Plotting with MATLAB

An Overview of MATLAB 16 Linear Algebra Equations the left division operator(\)  e.g.

An Overview of MATLAB 17 Statistics, Calculus, and Processing Statistics  perform statistical calculations and other types of data manipulation. Numerical Calculus, Differential Equations, and Simulink  MATLAB can numerically compute the derivative and the integral Symbolic Processing  obtain the derivative and the integral in symbolic form (a formula instead of as a set of numerical values)

An Overview of MATLAB 18 Script Files and the Editor/Debugger(1/2) Two ways for performing operations in MATLAB  Interactive mode : directly enter the commands in the Command window  using script files (commands files) : store the commands in script files M-files  script files :when need to use many commands or arrays with many elements  function files :when need to repeat the operation of a set of commands

An Overview of MATLAB 19 Script Files and the Editor/Debugger(2/2) M-file 생성 및 저장

An Overview of MATLAB 20 Input/output commands disp (A) Displays the contents, but not the name, of the array A. disp (‘text’) Displays the text string enclosed within single quotes. format Controls the screen’s output display format fprintf Performs formatted writes to the screen or to a file x = input (‘text’) Displays the text in quotes, waits for user input from the keyboard, and stores the value in x. x = input (‘text’, ’s’) Displays the text in quotes, waits for user input from the keyboard, and stores the input as a string in x k = menu (‘title’,’option1’,’option2’,…) Displays a menu whose title is in the string variable ‘title’, and whose choices are ‘option1’,’option2’, and so on.

An Overview of MATLAB 21 The MATLAB Help System(1/4) Help Browser  Graphical user interface  find information, view online documentation Help Functions  help, lookfor, doc  display syntax information for specified function Other Resources  run demos, contact technical support, participate in a newsgroup.  The MathWorks Website the home of MATLAB.

An Overview of MATLAB 22 The MATLAB Help System(2/4) - Help Browser The MATLAB Help Browser  Contents: a contents listing tab  Index: a global index tab  Search: a search tab having a find function and full text search features  Demos: a bookmaking tab to start built-in demonstrations

An Overview of MATLAB 23 The MATLAB Help System(3/4) - Help Functions MATLAB Help functions (help, lookfor, doc) FunctionUse docDisplays the start page of the documentation in the Help Browser doc functionDisplays the documentation for the MATLAB function function doc toolbox/functionDisplays the documentation for the specified toolbox function doc toolboxDisplays the documentation road map page for the specified toolbox helpDisplays a list all the function directories, with a description of the function category each represents. help functionDisplays in the Command window a description of the specified function function helpwin topicDisplays the help text for the specified topic inside the desktop Help Browser window lookfor topicDisplays in the Command window a brief description for all functions whose description includes the specified keyword topic type filenameDisplays the M-file filename without opening it with a text editor.

An Overview of MATLAB 24 The MATLAB Help System(4/4) - Help Functions Examples

An Overview of MATLAB 25 Programming in MATLAB(1/5) Relational operators  to make comparisons . >=, ==, ~= Conditional statements  to write programs that make decisions  if, else, elseif Loops  a structure for reputation a calculation a number of times  for, while

An Overview of MATLAB 26 Programming in MATLAB(2/5) Relational operatorMeaning <Less than <=Less than or equal to >Greater than >=Greater than or equal to ==Equal to ~=Not equal to >> x = [6, 3, 9]; y = [14,2,9]; >> z = (x < y) z = >> z = (x > y) z = >> z = (x == y) z = >> z = (x ~= y) z = >> z = (x > 8) z = Relational Operators

An Overview of MATLAB 27 Programming in MATLAB(3/5) The find Function  find(x) : computes an array containing the indices of the nonzero elements of the numeric array x  the find function returns the indices, not the values. >> x = [-2, 0, 4]; >> y = find(x) y = 1 3 >> x = [6, 3, 9, 11]; y = [14, 2, 9, 13] >> values = x(x<y) values = 6 11 >>how_many = length(values) how_many = 2 >>indices = find(x<y) indices = 1 4

An Overview of MATLAB 28 Programming in MATLAB(4/5) Conditional Statements  contain one or more of the if, else, and elseif  The end statement denotes the end of a conditional statement  The else and elseif statements may be omitted if not required. if x >= 9 y = 15*sqrt(4x) + 10 elseif x >= 0 y = 10*x + 10 else y = 10 end if expression commands elseif expression commands else commands end

An Overview of MATLAB 29 Programming in MATLAB(5/5) Loops  repeat a calculation a number of times  for loop : the number of passes is known ahead of time  while loop : the looping process must terminate when a specified condition is satisfied m = 0; x(1) = 10; for k = 2:3:11 m = m+1; x(m+1) = x(m) + k^2; end x(1) = 14, x(2) = 39, x(3) = 103, x(4) = 224 x = 5; k = 0; while x < 25 k = k+1; y(k) = 3*x; x = 2*x-1; end y(1) = 15, y(2) = 27, y(3) = 51