MATLAB Tutorial. Primary Author: Shoumik Chatterjee Secondary Author: Dr. Chuan Li

Similar documents
MATLAB basic guide to create 2D and 3D Plots. Part I Introduction

Desktop Command window

Introduction to MATLAB

INTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore

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

A Brief Introduction to MATLAB

Citrix Desktop for Home Computers Mac OS Instructions

Matlab and Octave: Quick Introduction and Examples 1 Basics

Murray Bridge High School Connecting to the BYOD Network Mac OS X Version 3 Amended 2/10/2014

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial

EE 216 Experiment 1. MATLAB Structure and Use

Matlab Tutorial: Basics

Introduction to MATLAB

Matlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.

Chapter 4: Programming with MATLAB

Using Citrix to access QFIS and other applications

University of Alberta

A very brief Matlab introduction

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

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

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

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

Introduction to Matlab

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

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

If using Internet Explorer:

MATLAB Introductory Course Computer Exercise Session

A Guide to Using Some Basic MATLAB Functions

Appserv Internal Desktop Access Mac OS Device with Safari Browser. Enter your Appserv username and password to sign in to the Website

MATLAB Introduction to MATLAB Programming

Math Scientific Computing - Matlab Intro and Exercises: Spring 2003

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Virtual Desktop: Mac Instructions /4/2018

Generes and Associates. Desktop Setup Guide LANDTECH ONLINE

Introduction to MATLAB

umapps Using umapps 6/14/2017 Brought to you by: umtech & The Center for Teaching & Learning

Grace days can not be used for this assignment

Getting Started with MATLAB

ENGR 253 LAB #1 - MATLAB Introduction

LabVIEW MathScript Quick Reference

Chapter 1 Introduction to MATLAB

Image Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan

MATLAB BEGINNER S GUIDE

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.

Some elements for Matlab programming

Remote Access User Guide for Mac OS (Citrix Instructions)

goremote.carolinas.org

Connecting to the Virtual Desktop Infrastructure (VDI)

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

Programming in Mathematics. Mili I. Shah

Computing Fundamentals Plotting

MATLAB The first steps. Edited by Péter Vass

MATLAB/Octave Tutorial

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA

AMS 27L LAB #2 Winter 2009

Introduction to MATLAB

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

Introduction to Unix and Matlab

JCCC Virtual Labs. Click the link for more information on installing on that device type. Windows PC/laptop Apple imac or MacBook ipad Android Linux

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

Plotting - Practice session

Lab. Manual. Practical Special Topics (Matlab Programming) (EngE416) Prepared By Dr. Emad Saeid

Virtual Desktop Infrastructure Setup for MacOS

Virtual Desktop Infrastructure Setup for MacOS

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis

Citrix Working Remotely Reference Guide

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

What is Matlab? A software environment for interactive numerical computations

CSE/NEUBEH 528 Homework 0: Introduction to Matlab

Introduction to Matlab

Setup Guide September 2013

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

A Very Brief Introduction to Matlab

1 Introduction. 2 Useful linear algebra (reprise) Introduction to MATLAB Reading. Spencer and Ware (2008), secs. 1-7, 9-9.3,

CDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB.

Can be put into the matrix form of Ax=b in this way:

ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)

MATLAB INTRODUCTION. Matlab can be used interactively as a super hand calculator, or, more powerfully, run using scripts (i.e., programs).

Finding MATLAB on CAEDM Computers

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

Math Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...

W1005 Intro to CS and Programming in MATLAB. Plo9ng & Visualiza?on. Fall 2014 Instructor: Ilia Vovsha. hgp://

Introduction to MATLAB programming: Fundamentals

CS335. Matlab Tutorial. CS335 - Computational Methods in Business and Finance. Fall 2016

Connecting Remotely Staff & Students

2.0 MATLAB Fundamentals

September 18, B Math Test Chapter 1 Name: x can be expressed as: {y y 0, y R}.

Gnuplot Tutorial. Gnuplot is a portable command-line driven graphing utility for - Linux, - MS Windows - Mac - Many other platforms.

MATLAB: Quick Start Econ 837

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

Introduction to MATLAB LAB 1

Introduction to MatLab. Introduction to MatLab K. Craig 1

A quick Matlab tutorial

EE 1105 Pre-lab 3 MATLAB - the ins and outs

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

CDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation

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

Transcription:

MATLAB Tutorial Primary Author: Shoumik Chatterjee Secondary Author: Dr. Chuan Li 1

Table of Contents Section 1: Accessing MATLAB using RamCloud server...3 Section 2: MATLAB GUI Basics. 6 Section 3: MATLAB Commands..9 Section 4: MATLAB Plots 10 Section 5: MATLAB Script Files..12 Section 6: MATLAB Functions...13 Section 7: Debugging MATLAB Scripts.14 2

Section 1: Accessing MATLAB using RamCloud server 1. Open Web Browser and go to RamCloud.wcupa.edu. 2. Login with WCU username and password. 3. Click checkbox to agree to Citrix license agreement and click Install. 3

4. Click the downloads icon on the MAC desktop and click the CitrixReceiverWeb.dmg file, which will move it to the desktop. 5. Click the Citrix Receiver icon to install, and click continue once installed. 6. If necessary, refresh browser and login again from RamCloud.wcupa.edu. 7. Click plus sign on the left side, select All APPS, and double-click the MATLAB icon. 4

8. If security warnings appear, click permit use/access. 9. Save all files to local computer hard drive by clicking File, Save As, Computer, C: drive, etc. 5

Section 2: MATLAB GUI Basics 1. When MATLAB is opened, the following desktop appears (in some instances, the two rightmost panels may be located as separate tabs underneath the left panel): 2. The desktop has four panels: i. The left panel is the current folder and allows you to access the project folders and files. 6

ii. The middle panel is the Command Window and it is where commands can be entered at the command line. It is indicated by the command prompt (>>). iii. The panel in the top right is the workspace and shows all the variables created and/or imported from files. 7

iv. The panel in the bottom right is the command history and shows or rerun commands that are entered at the command line. 8

Section 3: MATLAB Commands 1. How to enter simple commands and operations: i. Commands are entered in the command window. ii. The result of a variable or operation appears when Enter is pressed. iii. To suppress the result of a variable or operation, enter ; at line end. 2. How to enter matrices: i. MATLAB stores numerical results as matrices (even a number is 1 X 1 matrix). ii. Use [ to denote the start of a matrix and ] to denote the end of the matrix. iii. Use blank spaces to separate row entries. iv. Use semicolons (;) to separate columns. 9

Section 4: MATLAB Plots 1. How to plot 2-D function: i. Create a vector of x-values to evaluate the function. ii. Write equation for y in terms of x. iii. Include the figure keyword and the plot (x,y) function. iv. Include the xlabel( x ) and ylabel( y = f(x) ) to label the axes. v. Include grid on so grid appears. vi. Include title ( ) so title appears on top of graph. vii. Include legend ( ) so that the legend is shown. viii. Use axis([ ]) so that the axis is set to the desired range. 10

2. How to plot 3-D function: i. Set up vectors that represent the range of x and y values, in the following manner: x = xmin:xincrement:xmax; y = ymin:yincrement:ymax; ii. Make a grid of points over which to evaluate the heights of the surface, via the meshgrid function, as follows: [X,Y] = meshgrid(x,y); iii. Express z as a function of x and y. iv. To make a surface plot, type surf(x,y,z). v. To make a contour plot, type contour(x,y,z,n), where N is number of contour levels. x = [0:5:25]; y = [0:5:30]); [X,Y] = meshgrid(x,y); z = x.^2 - y.^2; surf(x,y,z) contour(x,y,z,10) 11

Section 5: MATLAB Script Files 1. Type edit or edit <filename>.m in the command window to open editor. 2. Type code in editor window. 3. Save editor file (1.e. File->Save). 4. Type filename (without.m extension) in command window (NOT editor) to run script file. 5. Command window displays result(s) of script file. 12

Section 6: MATLAB Functions 1. Functions allow the user to reuse sequences of commands by storing them in program files. 2. The format of a MATLAB functions is as follows: function [output1,,outputn] = functionname (input1,,inputm) MATLAB commands output1 = outputn = end 3. Call function from command line with different input parameters. 4. Command window displays function results. 5. Commonly used commands are as follows: dir- lists all files in current directory format- controls screen display format help- searches for help topic quit- stops MATLAB 6. Commonly used (built-in) functions are as follows: det matrix determinant inv matrix inverse eig - matrix eigenvalues rank matrix rank 13

Section 7: Debugging MATLAB Scripts 1. If MATLAB script is producing result(s) which are not correct or are unexpected, it is oftentimes useful to stop the script execution in the middle to isolate the specific variable(s) causing problem(s). 2. To stop program execution, implement a breakpoint at the start of the line by clicking the horizontal line immediately to the right of the line number on the command window. Implementing a breakpoint in front of line 10 stops the program in front of line 10. 3. Once a breakpoint is implemented, run the program 4. Once the command prompt appears (K>>), type a variable and press enter. 5. If the value returned by MATLAB is not correct, the error (bug) is located before the breakpoint. 14