1 CS1371 Introduction to Computing for Engineers Introduction to Matlab.

Slides:



Advertisements
Similar presentations
Introduction to Programming using Matlab Session 2 P DuffourJan 2008.
Advertisements

Matlab Intro Simple introduction to some basic Matlab syntax. Declaration of a variable [ ] Matrices or vectors Some special (useful) syntax. Control statements.
Python Basics: Statements Expressions Loops Strings Functions.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
Introduction to MATLAB 7 for Engineers
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.
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.
January 24, 2005 Lecture 3 - By P. Lin 1 CPET 190 Lecture 3 Problem Solving with MATLAB
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
INTRO TO PROGRAMMING Chapter 2. M-files While commands can be entered directly to the command window, MATLAB also allows you to put commands in text files.
Python Programming Fundamentals
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
1 Chapter 1 MATLAB Primer This introductory chapter is relatively short and has as its main objective the introduction of MATLAB ® to the reader. This.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (2): MATLAB Environment (Chapter 1)
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
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.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
Input, Output, and Processing
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Chapter 6: User-Defined Functions
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Intro to Matlab 1.Using scalar variables 2.Vectors, matrices, and arithmetic 3.Plotting 4.Solving Systems of Equations Can be found at:
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Matlab. Textbooks Required:, by Palm (3 rd edition) Required: Introduction to MATLAB for Engineers, by Palm (3 rd edition)
Engineering Analysis – Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
Basics of Matlab UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
Matlab for Engineers Matlab Environment Chapter 2.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
CS112 Scientific Computation Department of Computer Science Wellesley College Storing Values for Safe Keeping Variables and their Values.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
전자장 1 실험 - Matlab 사용법 - Photonic Systems Laboratory School of EE, Seoul National University Photonic Systems Lab School of EECS, S.N.U.
1 Introduction to Matlab. 2 What is Matlab? Matlab is basically a high level language which has many specialized toolboxes for making things easier for.
Matlab Training Session 4: Control, Flow and Functions
Introduction to Tharmarajah Thiruvaran March 2007.
MATLAB DENC 2533 ECADD LAB 9.
Lecture 1: Introduction
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Experiment No. (1) - an introduction to MATLAB
MatLab Program Used to Calculate Interactive
Introduction to Matlab
Chapter 2 MATLAB Environment
Presentation transcript:

1 CS1371 Introduction to Computing for Engineers Introduction to Matlab

2 Learning Objectives Discover how Matlab is designed and what the basic components do. Outline Matlab processor Basic language syntax Numbers in Matlab Matlab Desktop Array Basics Summary

3 Matlab Desktop Command Window Launch Pad History

4 Matlab Desktop – cont’d Command Window Workspace Current DIrectory

5 Matlab Help

6 Matlab Programs Matlab is an extravagant calculator if all we can do is execute commands typed into the Command Window… So how can we execute a “program?” Programs in Matlab are: –Scripts, or –Functions Scripts: Matlab statements that are fed from a file into the Command Window and executed immediately Functions: Program modules that are passed data (arguments) and return a result (i.e., sin(x)) These can be created in any text editor (but Matlab supplies a nice built-in editor)

7 Matlab Editor Color keyed text with auto indents tabbed sheets for other files being edited Access to commands

8 The Matlab Environment Matlab is an interpreted language –Commands are typed into the COMMAND Window and executed immediately –Variables are allocated in memory as soon as they are first used in an expression –Commands must be re-entered to be re-executed All variables created in the Command Window are in what is called the Base Workspace –Variables can be reassigned new values as needed –Variables can be selectively cleared from the workspace The Workspace can be saved to a data file –File extension is.mat (ex: mydata.mat) –File is in binary and essentially unreadable by humans –.mat files can be reloaded back into the Matlab Workspace

9 Commands, Statements & Variables At the prompt in the Command Window, you can enter either a: –Command: save mydata (saves workspace in mydata.mat ) whos (displays list of workspace variables) –Assignment Statement: A = width * length; B = 267; Assignment statements can have only a single variable on the left side of the assignment operator (=) The RHS is evaluated using current values for all variables and the resulting value is assigned to the variable on the LHS. Values can be numbers or characters The variable’s TYPE is always updated whenever a new assignment is made (warning: powerful but can lead to mistakes…) –Variables up to 31 characters (more are ignored); Case Sensitive

10 Reserved Words… Matlab has some special (reserved) words that you may not use… for end if while function return elsif case otherwise switch continue else try catch global persistent break

11 Matlab has Some Special Variables Special VariableDescription ans default variable name for results beep make sound pi mathematical constant eps smallest number that can be subtracted from 0 to make a negative inf infinity NaN not a number i (or) j imaginary number realmin, realmax smallest & largest positive real numbers bitmax largest positive integer nargin, nargout number of function in (or) out variables varargin variable number of function in arg’s varaout variable number of function out arg’s

12 Problems to Work 1.You throw a ball straight up in the air with an initial speed of 25 m/s. [g = 9.8 m/s 2 ] a.How long does it take to reach the highest point? b.How high does the ball rise from the release point? c.At what time(s) will it be 25 m above the release point? 2.You are constructing a hemispherical dome with radius 50ft. The walls will be solid concrete 9” thick. How may cubic yards of concrete will be needed? 3.A jet aircraft is flying 100ft above a level plain at 600 mph. Suddenly, the ground begins to rise at a 4 deg slope. How much time does the pilot have to raise the nose before the aircraft strikes the ground?

13 Summary Topics Matlab processor Basic language syntax Numbers in Matlab Matlab Desktop Basic Array Manipulation Summary Learning Objectives Discover how Matlab is designed and what the basic components do.

14 Questions?

15