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

Similar documents
WHAT IS MATLAB?... 1 STARTING MATLAB & USING THE COMMAND LINE... 1 BASIC ARITHMETIC OPERATIONS... 5 ORDER OF OPERATIONS... 7

The Order of Operations. Unit 1 Lesson 3

MATLAB The first steps. Edited by Péter Vass

An Introduction to MATLAB See Chapter 1 of Gilat

MATLAB. Miran H. S. Mohammed. Lecture 1

Introduction to MATLAB

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory

Why use MATLAB? Mathematcal computations. Used a lot for problem solving. Statistical Analysis (e.g., mean, min) Visualisation (1D-3D)

CS CS Tutorial 2 2 Winter 2018

Unit 10. Linux Operating System

Using the Zoo Workstations

Linux/Unix Filesystems

Introduction to Linux. Fundamentals of Computer Science

Activity 1 Creating a simple gradebook

Part I. Introduction to Linux

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

Getting Started with UNIX

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

Windows XP. A Quick Tour of Windows XP Features

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

CSC116: Introduction to Computing - Java

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

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

Due: February 26, 2014, 7.30 PM

Introduction to Engineering gii

CSC116: Introduction to Computing - Java

CMSC 201 Spring 2017 Lab 01 Hello World

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

CCBC Math 081 Order of Operations Section 1.7. Step 2: Exponents and Roots Simplify any numbers being raised to a power and any numbers under the

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.

Getting To Know Matlab

Chapter 1 Introduction to MATLAB

AN INTRODUCTION TO UNIX

Lecture 2 Introduction to MATLAB. Dr.Tony Cahill

The QuickCalc BASIC User Interface

Introduction to Unix - Lab Exercise 0

CSC116: Introduction to Computing - Java

Reading: Managing Files in Windows XP

Physics REU Unix Tutorial

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

Getting Started With UNIX Lab Exercises

Algebraic Expressions & Models L1.2. Welcome Back! Get your stuff out and be ready to go when the bell rings!

Python Programming Exercises 1

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Computers and Computation. The Modern Computer. The Operating System. The Operating System

Introduction to MATLAB

Tutorial 1: Unix Basics

CMSC 201 Spring 2018 Lab 01 Hello World

AMS 27L LAB #1 Winter 2009

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Automatic Member Synchronization

Linux File System and Basic Commands

You should see something like this, called the prompt :

A/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta

Chapter 1 Operations With Numbers

EXCEL BASICS: MICROSOFT OFFICE 2007

Programming Studio #1 ECE 190

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

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

User Guide Version 2.0

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

LAB 1 INTRODUCTION TO LINUX ENVIRONMENT AND C COMPILER

General Guidelines: SAS Analyst

Intermediate Programming, Spring Misha Kazhdan

Unit 13. Linux Operating System Debugging Programs

2. Click on the Launch button and select Terminal. A window will appear which looks like:

Introduction to Linux Environment. Yun-Wen Chen

Getting Started with Python and the PyCharm IDE

1 Installation (briefly)

When you first log in, you will be placed in your home directory. To see what this directory is named, type:

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

Setting Up and Using CCC Pathways Auto Workfile Entry Feature

LAB #5 Intro to Linux and Python on ENGR

Module 1: Introduction RStudio

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

EXCEL BASICS: MICROSOFT OFFICE 2010

Introduction to Linux

CS Fundamentals of Programming II Fall Very Basic UNIX

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

American International University- Bangladesh Faculty of Engineering (EEE) Control Systems Laboratory

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

Science One CS : Getting Started

Intermediate Microsoft Excel

1 Introduction to Matlab

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

CVEN 302. Computer Applications in Engineering and Construction. Dr. Tony Cahill Environmental and Water Resources Division

The purpose of this tutorial is to introduce you to the Construct 2 program. First, you will be told where the software is located on the computer

Accuterm 7 Usage Guide

Introduction to Matlab

Using WS_FTP. Step 1 - Open WS_FTP LE and create a Session Profile.

2.0 MATLAB Fundamentals

CISC 220 fall 2011, set 1: Linux basics

An Introductory Tutorial on UNIX

CS1600 Lab Assignment 1 Spring 2016 Due: Feb. 2, 2016 POINTS: 10

Lab 1 Introduction to UNIX and C

CM0340 Tutorial 2: More MATLAB

One of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:

Transcription:

INTRODUCTION: Matlab = Matrix Laboratory. It is designed to be great at handling matrices. Matlab is a high-level language and interactive environment. You write simple ASCII text that is translated into a lower-level language the computer can understand in order to perform calculations. No computer language is best for every application. Here are examples of high-level languages: - Matlab is great at manipulating matrices and is very user friendly. It is used in many different academic fields. - Fortran, C are great at pure number crunching, not as user friendly. Both are used extensively in engineering. - Maple and Mathematica are great at symbolic math and are very user friendly. Matlab will be a good first language, especially for engineers. The techniques you will learn in this course will apply to a lot of other languages. Once you learn one language, it is much easier to learn other languages. Here is a brief history of Matlab: http://74.125.155.132/search?q=cache:omoxn7jew_4j:www.cpe.ku.ac.th/~anan/courses/204111 -MATLAB/document-2004/2004-01-2-History-Matlab- Jim.ppt+matlab+history&cd=4&hl=en&ct=clnk&gl=us&client=firefox-a (Quick summary: Matlab was developed to do everything other high-level languages can do, but be much more user friendly.) TOOLS OF THE COURSE MATLAB/OCTAVE: In class and discussion, we will be using a free open-source program called Octave, which is very similar to Matlab. Whatever you learn using Octave will apply to Matlab for the purposes of this class, the two languages are interchangeable. I will be using Octave in my lectures and discussion sections. You can buy the student version of Matlab for ~$100 at the bookstore, or use it for free in some engineering labs. You can download Octave for FREE for Windows, UNIX, and Macs here: http://www.gnu.org/software/octave/download.html Here is the shortcut to the Windows version: http://sourceforge.net/projects/octave/files/octave_windows%20- %20MinGW/Octave%203.2.3%20for%20Windows%20MinGW32%20Installer/Octave-3.2.3-2_i686-pc-mingw32_gcc-4.4.0_setup.exe/download 1

From now own, I will assume that you are using Octave from a Windows machine. But these lecture notes will be similar if you are using a UNIX machine or a Mac. Starting Octave: (1) Using the Quick Launch icon: Once you have installed Octave, an icon should appear in your Quick Launch toolbar, on your Desktop, and/or under Start > Programs > GNU Octave 3.2.4 > Octave. Clicking this icon will start Octave. (2) Using Octave: After clicking the Octave icon, you will see a black window pop up with some text: GNU Octave, version 3.2.4 Copyright (C) 2009 John W. Eaton and others. This is free software; see the source code for copying conditions. (stuff) octave-3.2.3.exe:1:c:\octave\3.2.4_gcc-4.4.0\bin > (blinking cursor) All commands are issued from a command line, symbolized by the greater than sign (>). ls or dir see contents of current directory cd change directories delete remove file copyfile copy file movefile renames or moves files mkdir make directory rmdir remove directory clc clear screen exit closes terminal edit opens text editor pwd lists the pathway to the current directory.. double dots indicate one directory higher Keep in mind these commands are case sensitive. Let s try some commands out. First, where are we? ans = C:\Octave\3.2.4_gcc-4.4.0\bin 2

We are in the folder bin, which is in the folder 3.2.4_gcc-4.4.0, which is in the folder Octave, which is in the hard drive (C:). Let s look at the contents of this folder. Directory of C:\Octave\3.2.4_gcc-4.4.0\bin [.] history.dll [..] iconv.dll amd.dll intl.dll arpack.dll jpeg-7.dll (files and folders) hdf5.dll zlib1.dll 101 File(s) 82,491,596 bytes 2 Dir(s) 197,501,927,424 bytes free These are the files that run Octave and we don t want to mess around with them. Let s try moving around our computer using commands at the command line. First, move out of the current directory into the home directory. Type cd at the command line. > cd ans = C:\Users\Paul We are now in the home directory that is, we are in the folder Paul which is in a folder Users which is in the C: drive (the hard drive). You can get to the same folder using the graphical user interface (GUI). Go to My Computer > C: > Users > Paul. Note that the name Paul likely will be replaced by your username. Let s see what is in this directory. Directory of C:\Users\Paul [.] [Documents] sample.txt [..] [Downloads] [Saved Games] (more files and folders) 18 File(s) 537,890 bytes 13 Dir(s) 197,522,796,544 bytes free We can access what is on the Desktop by moving to the Desktop folder. > cd Desktop ans = C:\Users\Paul\Desktop You are now in the Desktop folder and can see what is on your Desktop. 3

Directory of C:\Users\Paul\Desktop (files and folders) 24 File(s) 545,995,563 bytes 19 Dir(s) 197,522,755,584 bytes free This is the list of items on your Desktop. Let s create a folder on your Desktop called HW_Assignments > mkdir HW_Assignments You should be able to see the folder HW_Assignments on your Desktop. What is in it? > cd HW_Assignements ans = C:\Users\Paul\Desktop\HW_Assignments You are in the correct folder. You should see nothing because there are no files or folders in this directory. Let s make a simple text file. > edit firstfile.txt A simple text editor should open up. Type anything you want, save the file, then close the text editor if you wish. Directory of C:\Users\Paul\Desktop\HW_Assignments [.] [..] firstfile.txt 1 File(s) 21 bytes 2 Dir(s) 187,437,633,536 bytes free Ta da! You have created a text file. Note that you can open this file from your normal graphical user interface. Next, we will move the file into a sub-folder 4

> mkdir HW1 (see the new directory HW1 and the old file firstfile.txt?) > movefile firstfile.txt HW1 ( firstfile.txt has been moved into the folder HW1 ) > cd HW1 (this is the new location of firstfile.txt ) If you want to move the file up one directory (out of HW1 and back into HW_Assignments ) you can type the following command, > movefile firstfile.txt.. (the double dots mean one level up) ( firstfile.txt has been moved out of HW1 ) > cd.. (there it is) You can make a copy of a file with the copyfile command. > copyfile firstfile.txt backup_firstfile.txt (you have made an identical copy with a different name) There are a couple of time-saving tricks you can use. - Cycle through old commands with the up arrow - Use TAB to auto-complete commands, file names, and folder names. (3) Starting Matlab: In Windows, you can start Matlab by clicking on Start > Programs > Matlab > Matlab. You are now at a command line. Notice the Matlab uses both a graphical user interface and a command line interface. It is more user friendly (and more expensive) than Octave. BASIC OPERATIONS: + - * / ^ (we will be learning more) In Octave, you can do mathematical operations from the command line. > 2 * 5 5

ans = 10 > 2/5 ans = 0.40000 > 2+5 ans = 7 > 2-5 ans = -3 > 2^5 ans = 32 You can do math with very large numbers too. Here I use scientific notation. > 2.4e4 + 1.2e4 ans = 3.6000e+004 > 2.4e4 + 1.2e3 ans = 2.5200e+004 2.4e4 is the same as 2.4 x 10 4, or 24000. ORDER OF OPERATIONS: Please Excuse My Dear Aunt Sally Parentheses, Exponent, Multiplication and Division, Addition and Subtraction The expression is evaluated left to right. Examples: > 2 + 5 * 3 ^ 2 2/2 ans = 46 > (2 + 5) * 3 ^ (2 2/2) ans = 21 6