Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions

Slides:



Advertisements
Similar presentations
Introduction to Applications & Basic Features. What is MATLAB®? MATLAB® /Simulink® is a powerful software tool for: Performing mathematical computations.
Advertisements

Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Introduction to Matlab EE 2303 Lab. MATLAB stands for “Matrix Laboratory” APPLICATIONS OF MATLAB:  Mathematical Calculations  Data Analysis & Visualization.
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
Introduction to MATLAB 3 November Instructor: Andy Newman Office Hours: Stop by room 306 (main building) whenever
Introduction to MATLAB Week 13 – 4/21/09. Instructor: Kate Musgrave Time: Tuesdays 3-5pm Office Hours: Tuesdays 1:30-3pm
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
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.
Programming in Matlab Day 1: Basics. Matlab as a calculator >> 2+2 ans = 4 >> 2^3 ans = 8 >> sqrt(2) ans = Command Window Basic operations Sum:
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.
Python Programming Fundamentals
THE MATLAB ENVIRONMENT VARIABLES BASIC COMMANDS HELP HP 100 – MATLAB Wednesday, 8/27/2014
Introduction to M ATLAB EE 100 – EE Dept. - JUST.
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.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
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 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
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.
Introduction to R Lecture 1: Getting Started Andrew Jaffe 8/30/10.
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.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
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.
1. Exam Topics Difference between computers and calculators John creates a new device. It will compute the orbit of all the planets in the solar system.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Winter Semester 2014/2015 College of Engineering.
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.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Getting Started with MATLAB (part 3) 1. Algebra, 2. Trig 3. The keyword ans 4. Clean up and suppress output: finalizing the software’s presentation 1.
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.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
Program Development C# Programming January 30, 2007 Professor J. Sciame.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
Topic Review for Exam 1 0.Infrastructure: You must be able to use MATLAB, Blackboard Exams, and Blackboard submissions 1. Computer Developing algorithms.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Engineering Computation with MATLAB First Edition by David M. Smith Chapter.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
MATLAB The name of MATLAB stands for matrix laboratory. Starting a MATLAB Session -On Microsoft® Windows® platforms, start the MATLAB program by double-clicking.
Fundamentals of Programming I Overview of Programming
Matlab Programming for Engineers
ECE 1304 Introduction to Electrical and Computer Engineering
Release Numbers MATLAB is updated regularly
Matlab Training Session 4: Control, Flow and Functions
Lecture: MATLAB Chapter 1 Introduction
Introduction to Matlab
Variables, Expressions, and IO
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
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
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
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.
Presentation transcript:

Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions Basic Math Functions Help/Doc Scripts P: Drive Comments

Fundamental components of MATLAB MATLAB stands for Matrix Laboratory MATLAB = a calculator + a lot more A computing system that interprets one instruction at a time. Instructions MUST conform to a specific syntax and vocabulary. A large library of modules that provide high-level capabilities for processing data. A collection of toolboxes, some providing graphical capabilities. A graphical user interface (GUI) to allow you to assemble your own professional looking software.

Double Click to bring up the MATLAB Interface Starting MATLAB Opening MATLAB in LB172: computer should have a direct shortcut on the desktop Any other LAB on campus, search: If not, use Ernie (directions online) Double Click to bring up the MATLAB Interface

DO NOT USE CITRIX IN THE LAB Why? …

None of these are helpful to write re-usable code. “Workspace” “The Command Window” “Current Directory” Shows the variables that have been created. “Your Calculator Screen” You can do exactly as on your calculator: add, subtract, divide, multiple, use parentheses to override the order of operations… Later on, you will realize you can do a LOT more in this frame. This frame shows the files (excel, text, MATLAB files) that can immediately be used. “Command History” It will show all the commands executed previously. None of these are helpful to write re-usable code.

1. Basic Data Manipulation Starting MATLAB leads to the prompt symbols >> in the command window If you don’t see the prompt symbols, MATLAB is busy MATLAB is loading MATLAB is doing 1,000,000 calculations… MATLAB has crashed MATLAB is stuck

Overview: most Operators There are 3 primary groups of operators One operator is very different in programming compared to math 1. ARITHMETIC + Addition - Subtraction * Multiplication /,\ Division ^ Exponentiation, i.e. “To the power of” 2. RELATIONAL < strictly less than > strictly greater than <= less than or equal to >= greater than or equal to == is equal to ~= is not equal to 3. BOOLEAN && “AND” || “OR” ~ “NOT” = “the assign operator”

MATLAB as a Calculator The MATLAB command window can be used as a boring old calculator. Precedence is similar to most calculators with a few MATLAB specific things. Left to right based on these things: Operator Symbol Description ( ) Parenthesis ' ^ Transpose (M.O.T.L.) and Power + - Signage (Positive/Negative), not Addition/Subtraction (yet) * / \ Multiplication & Division + - Addition & Subtraction : Colon (More on this later) Relational Operators (More on this later) Logical Operators (More on this later) 8

MATLAB as a Calculator Mistake you’ll make at least once! Power is before signage: -3^2 is different than (-3)^2 Operator Symbol Description ( ) Parenthesis ' ^ Transpose (More on this later) and Power + - Signage (Positive/Negative), not Addition/Subtraction (yet) * / \ Multiplication & Division + - Addition & Subtraction : Colon (More on this later) Relational Operators (More on this later) Logical Operators (More on this later) 9

Demo MATLAB as a calculator in the command window (without variables) Any single line contains a command/statement/instruction (different words for the same concept) The ans variable is the default location where MATLAB stores results.

Maintenance Functions clear clc close all commandwindow

Basic Math Functions sin cos tan sind sqrt abs help vs. doc help elfun

the “Editor” “Open a new script file"

A new window: the Editor This is where you’ll create a “script file” Save these type of files (on your P:/ drive )  absolutely re-usable

A new window: the Editor “Dock” this window to make it part of the regular windows below

Final common setup! 16

2. Run your statements (or hit F5) How to write “code”… 2. Run your statements (or hit F5) 3. See your results here 1. Type your statements, your code, your instructions,… here (Modify your statements, repeat cycle)

P: Drive The P: drive is space provided by ERAU that you can access from any ERAU computer. Getting files from your P: drive to your personal computer can be done through ERNIE/Citrix/Network File Access, but all the transferring must be done from within that program and it is sometimes grouchy.

Comments Comments are the most important part of your code. Put the algorithm steps (7a) in comments before you start Write the code that goes with the comments Update the comments to make them more detailed where needed. Someone else should be able to write your code based on your comments. % <- Supported by all versions of MATLAB %{ <- Must not have anything else on the line with open/close %} (Not supported in versions before 7/R14/2004)

Lessons learned New Vocabulary Command window Workspace Current Folder/Current Directory Command History Command Statements Instructions Prompt symbols Script file