CMPS 1371 Introduction to Computing for Engineers MatLab.

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

Introduction to Applications & Basic Features. What is MATLAB®? MATLAB® /Simulink® is a powerful software tool for: Performing mathematical computations.
Introduction to Programming using Matlab Session 2 P DuffourJan 2008.
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Lecture 5.
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Engineering Computation using MATLAB
Welcome to EGR 106 Foundations of Engineering II Course information Today’s specific topics: – Computation and algorithms – M ATLAB Basics Demonstrations.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Division Example 2x - 3y + 4z = 10 x + 6y - 3z = 4 -5x + y + 2z = 3 A*X = B where A = B = >> X = A\B X =
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.
Digital Image Processing Lecture3: Introduction to MATLAB.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
THE MATLAB ENVIRONMENT VARIABLES BASIC COMMANDS HELP HP 100 – MATLAB Wednesday, 8/27/2014
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.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
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.
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.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
Release Numbers MATLAB is updated regularly The Mathworks packages their software in groups, called releases, New releases are issued twice a year in the.
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
INTRODUCTION TO MATLAB LAB# 01
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.
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.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Winter Semester 2014/2015 College of Engineering.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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 &
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
1 CS1371 Introduction to Computing for Engineers Introduction to Matlab.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
EGR 115 Introduction to Computing for Engineers Introduction to MATLAB Friday 29 August 2014 EGR 115 Introduction to Computing for Engineers.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
Basics of Matlab UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative.
The Hong Kong Polytechnic University Industrial Centre MatLAB Lesson 1 : Overview & Environment Edward Cheung Room W311g.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
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.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 2.1 MATLAB ® opening window.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
ECE 1304 Introduction to Electrical and Computer Engineering
Arithmetic Operations
Release Numbers MATLAB is updated regularly
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
Lecture 1: Introduction
Matlab.
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Experiment No. (1) - an introduction to MATLAB
Using Script Files and Managing Data
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
Basics of Matlab UC Berkeley Fall 2004, E Copyright 2005, Andy Packard
Introduction to Matlab
Chapter 2 MATLAB Environment
Presentation transcript:

CMPS 1371 Introduction to Computing for Engineers MatLab

Getting Started In Windows click on the following: Programs Math & Science  MatLab R2008a

Getting Started MATLAB opens to a default window configuration

MATLAB uses a standard windows menu bar To exit MATLAB use the close icon

Command Window Enter commands at the prompt Current Directory MATLAB Windows Command History Workspace Window

MATLAB Windows MATLAB uses several different windows to display data, commands and results. They are not necessarily all open at once

Command Window Similar to a scratch pad Once you hit enter, you can’t edit any commands You can retype them or use the arrow keys to retrieve commands and edit them before hitting enter again Command Window

Command History Records the commands you issue in the command window When you exit the command window, or when you issue the clc command, the command window is cleared But the command history remains Command History

You can transfer commands from the command history to the command window Double click on a command Click and drag

Workspace Window Keeps track of the variables you’ve defined Name Value Class Size Bytes You may need to click on the name bar and select size and bytes in order to see these parameters Workspace Window

When you define variables in the command window, they are listed in the workspace window

Current Directory The current directory window is a list of files When you try to load information from a file or try to save information – MATLAB uses the current directory

Document Window If you double click on any variable in the workspace window MATLAB launches a document window containing the array editor You can edit variables in the array editor

Document Window

Figure Window When Figures are created a new window opens It’s extremely easy to create graphs in MATLAB

The semicolon suppresses the output from each command

Editing Window This window allows you to type and save a series of commands without executing them There are several ways to open an editing window From the file menu With the new file icon

Open an editing window from the file menu or with the new file icon

Save and Run Write your code in the editing window, then run it using the Save and Run icon

Solving Problems We’ve already solved some simple problems We need to understand how MATLAB works to solve more complicated problems

Variables MATLAB allows you to assign a value to a variable A=3 Should be read as A is assigned a value of 3 Use the variables in subsequent calculations

Naming Variables All names must start with a letter They may contain letters, numbers and the underscore ( _ ) Names are case sensitive There are certain keywords you can’t use

Keywords Use the iskeyword function for a list of keywords >>iskeyword ans = 'break' 'case' 'catch' 'continue' 'else' 'elseif' 'end' 'for' 'function' 'global' 'if' 'otherwise' 'persistent' 'return' 'switch' 'try' 'while'

Which of these names are allowed in MATLAB? test Test if my-book my_book Thisisoneverylongnamebutisitstillallowed? 1stgroup group_one zzaAbc z34wAwy?12# sin log x x x x x x bad idea

Scalar Calculations You can use MATLAB like you’d use a calculator >> ans=19 Command Prompt Result

Assignment Operator To define a variable a we might type a=1+2 which should be read as: “a” is assigned a value of 1+2

Order of Operation Same as you’ve learned in math class Same as your calculator Parentheses first Exponentiation Multiplication / division Addition / subtraction

Order of Operation 5*(3+6)= 45 5*3+6= 21 White space does not matter!!! 5*3 + 6= 21

Parentheses Use only ( ) { } and [ ] mean something different MATLAB does not assume operators 5 * (3+4) not 5(3+4)

Compute from left to right 5*6/6*5= 25 5*6/(6*5)= 1

Here’s an example Find the surface area of a cylinder r = radius r = 5 h = height h = 10 π r 2 2π r * h

Try some Type each expression on the command line and then press Enter >> / 2 >> (7 + 8) / 2 >> 5 ^ 3 / 2 >> sqrt(64) >> x = 15 >> x = 3 * x – 12 >> y = pi >> z = y * 2 >> A = 12; >> B = 4; >> C = A / B + A – B * 2; >> C