MATLAB Introduction Dr. Theodore Cleveland University of Houston

Slides:



Advertisements
Similar presentations
DOS & Windows O/s Prof. Sujata Rao Less 5.
Advertisements

Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Stata and logit recap. Topics Introduction to Stata – Files / directories – Stata syntax – Useful commands / functions Logistic regression analysis with.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
Lecture 7 Sept 17 Goals: Complete Chapter 4 Chapters 5 and 6.
Lecture 7 Sept 29 Goals: Chapters 5 and 6. Scripts Sequence of instructions that we may want to run can be stored in a file (known as script). by typing.
ES 100: Introduction to Engineering Use of the Computer 1.Log in using your Novell password. If you do not know your password, immediately (now!) see Al.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Digital Image Processing Lecture3: Introduction to MATLAB.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
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.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
1 ITI 1120 Lab # 1 An Introduction to the Lab Environment Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
Outline Comparison of Excel and R R Coding Example – RStudio Environment – Getting Help – Enter Data – Calculate Mean – Basic Plots – Save a Coding Script.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Winter Semester 2014/2015 College of Engineering.
Introduction to Engineering MATLAB – 7 Script Files - 2 Agenda Script files continued.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Files: By the end of this class you should be able to: Prepare for EXAM 1. create an ASCII file describe the nature of an ASCII text Use and describe string.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
EGR 115 Introduction to Computing for Engineers Designing The Battleship Game in MATLAB Monday 22 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Illustrator lecture 1: how to use Adobe Illustrator with raster maps? Yhd Water and people.
Getting started with Matlab: Outline
Matlab Programming for Engineers
Introduction to Matlab
Release Numbers MATLAB is updated regularly
Prof. Mark Glauser Created by: David Marr
Appendix B MathScript Basics
Lecture: MATLAB Chapter 1 Introduction
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Chapter 4 MATLAB Programming
MATLAB DENC 2533 ECADD LAB 9.
(Mohammed Sami) Ashhab
CS190/295 Programming in Python for Life Sciences: Lecture 1
Advanced Data Import & Export Jeff Henrikson
Matlab review Matlab is a numerical analysis system
Use of Mathematics using Technology (Maltlab)
MATLAB Tutorial Dr. David W. Graham.
Lecture 2 Introduction to MATLAB
Code is on the Website Outline Comparison of Excel and R
Digital Image Processing
CSCI N207 Data Analysis Using Spreadsheet
Communication and Coding Theory Lab(CS491)
funCTIONs and Data Import/Export
CSE 307 Basics of Image Processing
Stata Basic Course Lab 2.
Using Script Files and Managing Data
Matlab Basics Tutorial
Your objective: to dominate! My objective: to help you dominate!
Importing Excel Data & Exporting Data to Excel
Programming The ideal style of programming is Structured or
ME 123 Computer Applications I Lecture 5: Input and Output 3/17/03
Presentation transcript:

MATLAB Introduction Dr. Theodore Cleveland University of Houston CIVE 1331 – Computing for Engineers Lecture 016 NEXT LECTURE: Powerpoint, EXCLE

Mat Lab Environment MatLab – Getting Going – Parallels with FORTRAN and EXCEL………………………………..3 Assign Values………………………………………5 Saving Your Work……………………………………..7 Reading data from an ASCII file ……………….10 Matrix Operations ……………………………………14 Plotting …………………………………………………..17 Generating Scripts (Programs )………………….21 Programming the Problem…………………..24 Change PATH variable and attempt to run the code ……………………………………..25

MatLab – Getting Going – Parallels with FORTRAN and EXCEL Assumptions: You have tested your account and can invoke some version of MatLab. Release12 and Release13 are currently available for this class. Use R13 unless it messes up, then use R12. I demonstrated R12 in lecture.

MatLab – Getting Going – Parallels with FORTRAN and EXCEL Variables: Variables have names and contain values. Matlab considers all variables to be arrays; scalars are 1 x 1 arrays.

MatLab – Getting Going – Parallels with FORTRAN and EXCEL Assign values: To assign a value simply use FORTRAN like syntax; X=3.2; y=7.5 Matrix2x2=[[1,2];[3,4]] The delimiters “[“ and “]” enclose lists. The delimiter ; separates lists (it also suppresses output when used at end of a command). The matrix is a list of lists. Technically X and Y could have been entered as X=[3.2] ; y=[7.5]

MatLab – Getting Going – Parallels with FORTRAN and EXCEL Figure 1. Assigning Values

Saving Your Work To save your work you must point the program to a directory where you have write privileges, such as your H: directory in the ECC; and ZipDrive; a FloppyDrive; a USB drive; or even the C:\WORK or C:\TEMP directory. To change where the program reads and writes data files use either the Current Directory winder in the program or enter the command line disk operations commands: dir; delete, cd, path. (See pg 19 of the text).

Saving Your Work The next two figures illustrate both approaches Figure 3. Setting directory using commands.

Saving Your Work Now to save the work, simply type the save command or choose save using the File/Save or File/SaveAs Figure 4. Save command and file name (lecture010)

Reading Data From an ASCII File Suppose we have the following ASCII files: Figure 5. amat.dat contents

Reading Data From an ASCII File Then we can read these data into the MatLab program using the load command. Figure 6. rhs.dat

Reading Data From an ASCII File Figure 7. Loading data into the program.

Reading Data From an ASCII File We can also write to files (see page 24 and 25 of the text). These activities are equivalent to the FORTRAN read(unit,fmt) var_list and write (unit,fmt) var_list structures we studied earlier.

Plotting Suppose we want to plot the y=Bessel(0,x) for x = 0,5,0.2 (FORTRAN like syntax). In Matlab we simply construct two vectors then plot them. Figure 9. Setting up the plot vectors.

Plotting Figure 10. Resulting Plot

Plotting Now recall in Week 3 (and in labs) we got nicked for leaving labels off the graphics. To add labels we simply instruct the plotting tool to include labels (either in the command line, or after-the-fact in the plot window).

Plotting Read pages 44-51 for more on plotting. Figure 11. Improved plot image Read pages 44-51 for more on plotting.