Matlab Programming MET 164 1/24

Similar documents
An Introduction to MATLAB

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

An Introduction to MATLAB. Lab tutor : Dennis Yang LIU Lab 1: Sept. 11, 2014

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA

CITS2401 Computer Analysis & Visualisation

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

An Introduction to MATLAB See Chapter 1 of Gilat

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

Introduction to MATLAB

Chapter 1: An Overview of MATLAB

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

Introduction to Engineering gii

MATLAB The first steps. Edited by Péter Vass

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

Step by step set of instructions to accomplish a task or solve a problem

Introduction to MATLAB

To start using Matlab, you only need be concerned with the command window for now.

Introduction to MATLAB

QUIZ: What is the output of this MATLAB code? >> A = [2,4,10,13;16,3,7,18; 8,4,9,25;3,12,15,17]; >> length(a) >> size(a) >> B = A(2:3, 1:3) >> B(5)

EGR 111 Introduction to MATLAB

Welcome to EGR 106 Foundations of Engineering II

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain

MATLAB TUTORIAL WORKSHEET

Table of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7

Starting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to.

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1

MATLAB BASICS. M Files. Objectives

Getting started with MATLAB

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT

2.0 MATLAB Fundamentals

Lecture 1: Hello, MATLAB!

Outline. CSE 1570 Interacting with MATLAB. Outline. Starting MATLAB. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.

ECE Lesson Plan - Class 1 Fall, 2001

Introduction to Scientific Computing with Matlab

Chapter 3: Programming with MATLAB

Chapter 1 Introduction to MATLAB

MATLAB Project: Getting Started with MATLAB

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB:

Engineering Innovation Center MATLAB Basics

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Introduction to MatLab. Introduction to MatLab K. Craig 1

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An

Part #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr

CM0340 Tutorial 2: More MATLAB

Desktop Command window

MATLAB. Devon Cormack and James Staley

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Chapter 2 Basic Elements of C++

MATLAB Basics 2 simple calculations and use

Introduction to MATLAB

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

ECE 3793 Matlab Project 1

MATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY

Introduction to MATLAB

ENGR 105: Introduction to Scientific Computing. Dr. Graham. E. Wabiszewski

Introduction to MATLAB

Introduction to programming in MATLAB

MATLAB An introductory tutorial

Matlab Programming Introduction 1 2

Introduction to MATLAB

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.

Working with JavaScript

Differentiate Between Keywords and Identifiers

MATLAB Part 1. Introduction

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

Memory Usage in Programs

Chapter 2: Introduction to C++

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

Matlab = Matrix Laboratory. It is designed to be great at handling matrices.

MATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning.

INTRODUCTION TO MATLAB

Teaching Manual Math 2131

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group

Course Layout. Go to follow instr. Accessible within campus (only for the first download)

Matlab Tutorial 1: Working with variables, arrays, and plotting

ME 1020 Engineering Programming with MATLAB. Chapter 1 In-Class Assignment: 1.1, 1.3, 1.13, Topics Covered:

Introduction to MATLAB

YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM

The Cantor Handbook. Alexander Rieder

Essentials for the TI-83+

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

General Information. There are certain MATLAB features you should be aware of before you begin working with MATLAB.

Introduction to MATLAB Programming

Full file at

How to program with Matlab (PART 1/3)

function [s p] = sumprod (f, g)

ME 121 MATLAB Lesson 01 Introduction to MATLAB

Note 10 Introduction to MATLAB & SIMULINK

CHAPTER INTRODUCTION

GLY Geostatistics Fall Lecture 2 Introduction to the Basics of MATLAB. Command Window & Environment

Lab 1 Intro to MATLAB and FreeMat

McTutorial: A MATLAB Tutorial

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

1 Overview of the standard Matlab syntax

Digital Image Processing

Transcription:

Matlab Programming 1/24

2/24 What does MATLAB mean? Contraction of Matrix Laboratory Matrices are rectangular arrays of numerical values 7 3 6 2 1 9 4 4 8 4 1 5 7 2 1 3

What are the fundamental components of Matlab? Computing system that accepts one instruction at a time in text form Large library of modules that provide high-level capabilities for processing data Graphical user interface (GUI) that lets users assemble and implement programs to solve a problem 3/24

What are the advantages and the disadvantages? Advantages interpreted language numerical calculator built in graphics Disadvantages does not work well for large computing projects (many developers) professional GUIs are best written in compiled language 4/24

Programming Language Background Abstraction expressing a quality apart from a particular implementation Algorithm sequence of instructions for solving a sub-program Programming Paradigms a set of assumptions, concepts, values, and practices that constitutes a way of viewing reality for the community that shares them, especially in an intellectual discipline 5/24

What does expressing a quality apart from a particular implementation (abstraction) mean? It is things that we use in everyday conversation He used his bicycle to ride home from campus Procedural abstraction: the details will be different based on the user to instruct the ride home. To convert from lb to N, multiply the force by 4.448 Data abstraction: details about the force will determine how you do the conversion. 6/24

What does sequence of instructions for solving a subprogram (algorithm) mean? Instructions that we use to problem solve Problem: The car needs to be fixed 1) Change the oil 2) Drain the old oil, remove the old oil filter, install a new oil filter, fill the old pan with new oil 3) Place the vehicle on ramps, place a container under the oil pan to catch the old oil, etc. The algorithm is full of abstractions that are based on what is computing the algorithm 7/24

Programming Paradigms You will have a better understanding of programming paradigms after you have learned basic programming 8/24

Now, let s start talking about basic data manipulation within Matlab z = x + y In algebra, this is a two way relationship x + y = z In programming, this is the sum of two values associated to a new name; it can be changed with the next statement z = 4x - y In algebra this represents a constraint on the values, but in programming, this is an assignment statement 9/24

When we start to define data to variables in Matlab, we need to use appropriate syntax Variables upper or lowercase letters, numbers, and _ not $ or 64 unique characters Variables may be words no spaces use underscore or caps velocity_feet_per_second VelocityFeetPerSecond 10/24

Matlab is an untyped language Variables are given a specific type when assigned Issues Numeric (double) x = 7 Character (char) x = I like programming misspelled variables may cause errors (without notice) logic errors with incompatible data Typed languages (weak or strong) allow the programmer to assign types and interactions before running or compilation 11/24

Now, let s look at Matlab and talk about some of the things we see Current Folder Command Window Workspace Tab Command History This layout may be adjusted to the user preference 12/24

One way to adjust the layout is to use the layout feature on the top window 13/24

Matlab can be used in two modes: Command mode or Edit mode Command mode appears as a scientific calculator Edit mode able to type in numerous commands before executing 14/24

Matlab can be used in two modes: Command mode or Edit mode Command mode appears as a scientific calculator Edit mode able to type in numerous commands before executing (use what are called scripts) 15/24

The workspace provides a list of variables always keeps the variables in alphabetical order ans is a special variable The clear command allows you to clear which ever workspace variable you want. Example clear AA BB to clear variable AA and BB or clear all to clear all of the variables (note: the quotes are not used) 16/24

The workspace always keeps the variables in alphabetical order Double clicking on a variable in the workspace will allow you to see the variable and change its value You may also paste the data here from another source 17/24

The Command History pane will allow you to fix mistakes that you have made The clc command allows you to clear all of the stuff that is in the command window, but leaves all of the history and workspace variables to use later whos will allow you to see all of the variable information in the command window 18/24

The output will have specific formats in the Command Window A semicolon will suppress the presentation of the result 19/24

Matlab has built in figure windows that allows you to plot data close, figure 20/24

Matlab has a built in text editor that allows you save a script for running later 21/24

Matlab has a built in text editor that allows you save a script for running later The result will show in the Command Window 22/24

Additional syntax ; close clear clc ^ plot who whos % 23/24

Use the text editor to write your scripts and start using comments Start using the text editor Start using comments Try different commands and see what happens 24/24