Math 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau)
|
|
- Rolf Turner
- 5 years ago
- Views:
Transcription
1 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) January 24, 2010
2 Starting Under windows Click on the Start menu button Click on the menu entry Under Linux Use SSH to log onto linux.unm.edu Type matlab Starting Desktop Tools Getting Help Saving your work
3 Desktop Tools Command Window type commands Workspace view program variables double click on a variable to see it in the Array Editor Command History view past commands Current Directory view and select files in the current directory the current directory can be changed in the toolbar To switch to the default windows arrangement, go to menu Desktop > Desktop Layout > Default Starting Desktop Tools Getting Help Saving your work
4 Getting Help Using the Help Browser From command window >> help >> help plot Running demos >> demos >> help demos Starting Desktop Tools Getting Help Saving your work On the web
5 Saving your work in class, create your directory (folder) in T: drive files reside on the current directory or the search path >> addpath T:\myfolder >> addpath ~/matlab you can save a whole session using >> diary "diary_jan23.txt" >> diary off >> diary on Starting Desktop Tools Getting Help Saving your work bring your flash card (floppy, CD-RW) to save class work or upload your files to your UNM storage (?)
6 Variables creating a variable ( is case sensitive); semicolon suppresses output >> x = 5; >> x = 5 x = 5 checking variables >> whos Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts deleting a variable >> clear x deleting all variables >> clear
7 Build-in constants Imaginary unit i = j = 1 and π >> clear >> pi pi = >> i i = 0 + 1i >> j j = 0 + 1i Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts Build-in constants can be overridden >> i = 8 i = 8 >> clear >> i i = 0 + 1i
8 Arithmetic operators + addition subtraction * multiplication / division ˆ power complex conjugate and transpose.* element-by-element mult./ element-by-element div.ˆ element-by-element power. transpose Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts
9 Relational and logical operators == equal = not equal < less than <= less than or equal > greater than >= greater than or equal & AND OR NOT Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts
10 Mathematical functions Elementary functions (sin, cos, sqrt, abs, exp, log10, round) >> help elfun Advanced functions (bessel, beta, gamma, erf) Example >> help specfun >> help elmat >> x=2.3; a=sin(x), b=cos(x) Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts a = b = >> c = ( sin(x) )^2 + ( cos(x) )^2 c =
11 scripts Example of script file (myscript.m) myscript.m % This is a comment. % convert cartesian coordinares (x,y) % to polar coordinates (r,theta) x = 4; y = 3; r = sqrt(x^2 + y^2) theta = atan(y/x) Variables Build-in constants Arithmetic operators Logical operators Math functions Scripts % continuation character is... Save it in your working directory Call it from the command window >> myscript
12 Creating vectors >> x = [ ] % separated by spaces x = >> x = [1, 2, 5, 3] % separated by commas x = >> y = [6; 7; 4; 8] >> y = x y = y = Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises Note: A = transpose ( A )
13 More ways of creating vectors Using increment x 1 : x : x n >> x = 0:0.2:1 x = Using linspace (x 1, x n, n) >> x = linspace(0,1,6) x = Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises Note: both points are included, x = xn x1 n 1
14 Creating matrices Explicitly >> A = [1 2 3; 4 5 6; 7 8 9] A = Using functions >> M = 2; N = 3; >> a = zeros(m, N) >> b = ones(m, N) >> c = rand(m, N) >> I = eye(n) Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises scalar is 1 1 matrix vector is 1 N or N 1 matrix you can create N 1 N 2... N n matrices
15 Matrix addition (or subtraction) element by element C = A + B : ( a11 a 12 a 21 a 22 ) ( b11 b + 12 b 21 b 22 C ij = A ij + B ij ) ( a11 + b = 11 a 12 + b 12 a 21 + b 21 a 22 + b 22 >> A = [1 2; 3 4] >> B = [5 6; 7 8] A = B = ) Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises >> C = A + B C = being added must be the same size
16 Matrix multiplication not element by element C = AB: ( a11 a 12 a 21 a 22 ) ( b11 b 12 b 21 b 22 C ij = n k=1 A ikb kj ) ( a11 b = 11 + a 12 b 21 a 11 b 12 + a 12 b 22 a 21 b 11 + a 22 b 21 a 21 b 12 + a 22 b 22 >> A = [1 2; 3 4] >> B = [4 3; 2 1] A = B = ) Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises >> C = A * B >> C = A.* B C = C = For element by element multiplication use.*
17 Accessing elements of a matrix >> A = [1 2 3; 4 5 6; 7 8 9] A = A(i, j) subscription - numbering starts from 1 (Fortran style) >> A(2,3) ans = 6 Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises whole row >> x = A(2,:) x = whole column >> y = A(:,3) y = 3 6 9
18 Accessing elements of a matrix (cont.) Matrix elements can be accessed by index array. Try the following: >> v = 10:10:80 >> ind = [3,4,7] >> v(ind) >> v(ind) = or by condition: >> v = 10:10:80 >> v>30 >> v(v>30) = -1 Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises
19 Matrix operations [ ] concatenation >> x = [ zeros(1,3) ones(1,2) ] x = ( ) subscription >> x = [ ]; >> y = x(2) y = 3 Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises >> y = x(2:4) y = 3 5 7
20 Finding matrix size Explain the output of the following command >> A = [1 2 3; 4 5 6] >> ndims(a) >> length(a) >> size(a) >> [n m] = size(a) >> sum(a) >> sum(a,1) >> sum(a,2) Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises
21 What happens when you run the following commands? Why? >> x = 0:1:5 >> y = x*x >> y = x.*x >> y = x^2 >> y = x *x >> y = x*x >> y = 2*x >> y = 1./x >> x = 0:0.1:1 >> y = x(4:8) >> y = x(5:) >> y = x([1,5,7,11]) Creating vectors More ways... Creating matrices Addition Multiplication Accessing elements... more Matrix operations Matrix size Exercises >> A = [1 2 3; 4 5 6; 7 8 9] >> B = A((2:3),(2:3)) >> C = sin([0, 0.5*pi, pi, 1.5*pi])
22 Simple plot plots arrays. Arrays must be created first! >> t = 1:1:7 >> plot(t, sin(t)) More points - smoother line >> x = 1:0.1:7; >> y = sin(x); >> plot(x, y) Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise Note: y(x) is plotted, not x(t) and y(t). Vectors x and y must be the same length. To create a graph in logaritmic coordimates use loglog, semilogx, or semilogy instead of plot.
23 Label you plots! Once we created the plot... >> x = linspace(0, 2*pi, 50); >> y = sin(x); >> plot(x, y, o-r ) % plot with red circles we can add features to it >> axis([0, 2*pi, -1.1, 1.1]) >> xlabel( x ); ylabel( y ) >> title( Plot of the sine function ) >> leg( y(x) = sin(x), Location, NorthEast ) >> grid on Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise You can edit figure using menu functions.
24 Saving plots to files Save your figure as *.fig - this way you can modify it later. Save PDF on letter-size paper. Here gcf is the handle to current figure ( get current figure ). The plot position on the paper is given as the coordinates of upper-left and lower-right corners >> set(gcf, papersize, [8.5, 11],... paperposition, [1, 1, 6, 4]) >> saveas(gcf, myplot.pdf, pdf ) Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise If figure to be inserted into a document, use paper size same as plot size >> set(gcf, papersize, [6, 4],... paperposition, [0, 0, 6, 4]) >> saveas(gcf, myplot.pdf, pdf )
25 Marker options (type help plot to remind) b blue. point - solid g green o circle : dotted r red x x-mark -. dashdot c cyan + plus -- dashed m magenta * star (none) no line y yellow s square k black d diamond w white v triangle (down) ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise
26 Multiple graphs, panels, and figures Multiple graphs on the same plot (also see help hold) >> x = linspace(0, 2*pi, 100); >> y1 = cos(3*t).* exp(-0.5*t); >> y2 = sin(3*t).* exp(-0.5*t); >> plot(t,y1, x, t,y2, * ) To open new figure (new window) >> figure >> figure(1) %make figure 1 current figure Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise To divide figure to panels >> subplot(2,2,1) >> plot(t,y1) >> subplot(2,2,2) >> plot(t,y2) >> subplot(2,2,3) >> plot(y1,y2)
27 In class exercise By plotting y(t) below with different values of parameter a find a at which y(t) passes through given experimental points as close as possible y(t) = e t 2 sin(at) t = y = Simple plot Label you plots! Saving plots Markers Multiple Plots In class exercise
28 User defined functions Unlike scripts, functions can take arguments and return values Like scripts, functions reside in M-files (*.m) Name of the file = name of the function Example of function file mycomplex.m mycomplex.m function z = mycomplex(x,y) z = x + i*y; User defined more... more Function handles here x and y are arguments, z is returned value, and mycomplex is the name of the function Call it from command line or from another function >> c = mycomplex(a,b)
29 User defined functions (cont.) can take matrices as arguments can return multiple values You can put several functions in a single M-file. Example: function file myplot.m myplot.m function myplot [x,y] = mydata(n); plot(x,y); User defined more... more Function handles function [x,y] = mydata(n) x = linspace(0, 2*pi, n); y = sin(x); Can we call mydata(n) from command line?
30 User defined functions (cont.) Example: function file mycart2pol.m mycart2pol.m function[ radius, theta ] = mycart2pol(x, y) % convert cartesian coordinares (x, y) % to polar coordinates (r, theta) theta = atan2(y, x); radius = sqrt(x.^2 + y.^2); User defined more... more Function handles What happens when you call mycart2pol as following? >> mycart2pol(1,1) >> r = mycart2pol(1,1) >> [r th] = mycart2pol(1,1) >> [r th] = mycart2pol([ ], [0 0 0]) >> help mycart2pol
31 Function handles There are a number of useful functions which take function handle as an argument Example: to numerically evaluate integral cube.m 2 1 x 3 dx = 1 4 ( ) = 3.75 using function quad we first create file cube.m function y = cube(x) y = x.^3; User defined more... more Function handles and then pass the function handle (@cube) and integration limits (1,2) to quad >> quad(@cube, 1, 2) or create inline function, defined by the string >> f = inline( x.^3 ); >> quad(f, 1, 2)
32 For loop The for loop executes a statement or group of statements a predetermined number of times. for x = x 1 : x : x n statement The increment x can be omitted; default x = 1 for x = x 1 : x n statement For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O The index of a for loop can be an array. v=v 1 : v : v n for x = v statement For loops can be nested
33 For loop: examples >> format compact >> for n = 1:5 disp(n) >> for n = 0.5:0.1:0.8 disp(n) >> v = [2, 4, 8, 16]; >> for n = v disp(n) For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O >> for j = 1:3 for i = 1:3 A(i,j) = i+j;
34 For loop: examples Create vector [ ] in a classical way >> v = zeros(1,5) % allocate space >> for i=1:5 % cycle through the elements v(i)=i % assign value to each element Note: allocation is optional (but it makes the code run faster). Try the following: >> clear v >> for i=1:5 v(i)=i For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O >> v = zeros(1,5) >> a = v(8) >> v(8) = 8
35 While loop The while loop executes a statement or group of statements repeatedly as long as the controlling expression is true while condition statement >> x=1; >> while x > 0.01 x = x/2 For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O
36 If statement If evaluates a logical expression and executes a group of statements based on the value of the expression. if condition statement Example: find the maximum element in an array: >> v=rand(1,6) >> vmax = -1; >> for i=1:length(v) if v(i) > vmax vmax = v(i); >> disp(vmax) For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O But, of coarse, it is easier just to do >> vmax = max(max(v))
37 If-else statement if-else can take care for both branches of the fork... if condition1 statement1 else statement2... or multiple branches if condition1 statement1 elseif condition2 statement2 elseif condition3 statement3 else statement4 For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O
38 If-else example Script rps.m simulates a rock-paper-scissors player rpm.s % simulate a rock-paper-scissors player x = rand(1) % get random number between 0 to 1 x = x*3 % rescale x so that 0 < x < 3 if x<1 disp( rock! ) elseif x<2 disp( paper! ) else disp( scissors! ) For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O
39 Other program control statements continue passes control to the next iteration of the loop break terminates the execution of a loop return exits the currently running function switch executes statements based on the value of a variable or expression try, catch error control statements For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O Note: there is no goto statement in
40 Simple text input and output C-style output to the screen >> fprintf( square root of %d is %6.3f\n, 3, sqrt(3)) square root of 3 is The same output can be directed to a file >> fid=fopen( mydata.txt, wt ); >> fprintf(fid, %s\n, % k sqrt(k) ); >> for k=1:3 fprintf(fid, %d >> fclose(fid); %6.3f\n, k, sqrt(k)); For loop For loop: examples For loop: examples While loop If statement If-else statement If-else example Other statements Simple text I/O An easy way to load text data >> load mydata.txt >> disp(mydata)
Matlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationMAT 275 Laboratory 1 Introduction to MATLAB
MATLAB sessions: Laboratory 1 1 MAT 275 Laboratory 1 Introduction to MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory
More informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More information1. Register an account on: using your Oxford address
1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation
More informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationMATLAB SUMMARY FOR MATH2070/2970
MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should
More informationInteractive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems
More informationWhat is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment
What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful
More informationCreates 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.
EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses
More informationIntroduction to MatLab. Introduction to MatLab K. Craig 1
Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationMATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations
MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding
More informationChapter 2. MATLAB Fundamentals
Chapter 2. MATLAB Fundamentals Choi Hae Jin Chapter Objectives q Learning how real and complex numbers are assigned to variables. q Learning how vectors and matrices are assigned values using simple assignment,
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationMATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline
MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationCSE/NEUBEH 528 Homework 0: Introduction to Matlab
CSE/NEUBEH 528 Homework 0: Introduction to Matlab (Practice only: Do not turn in) Okay, let s begin! Open Matlab by double-clicking the Matlab icon (on MS Windows systems) or typing matlab at the prompt
More informationIntroduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis
Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationThis is a basic tutorial for the MATLAB program which is a high-performance language for technical computing for platforms:
Appendix A Basic MATLAB Tutorial Extracted from: http://www1.gantep.edu.tr/ bingul/ep375 http://www.mathworks.com/products/matlab A.1 Introduction This is a basic tutorial for the MATLAB program which
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More informationMATLAB Introduction to MATLAB Programming
MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed
More informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
More informationAppendix A. Introduction to MATLAB. A.1 What Is MATLAB?
Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system
More informationMATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University
MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationOutline. CSE 1570 Interacting with MATLAB. Outline. Starting MATLAB. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 10 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More informationMatlab Tutorial and Exercises for COMP61021
Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a
More information! The MATLAB language
E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical
More informationMATLAB Functions and Graphics
Functions and Graphics We continue our brief overview of by looking at some other areas: Functions: built-in and user defined Using M-files to store and execute statements and functions A brief overview
More informationChapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1
Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values
More informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More informationWhat is Matlab? A software environment for interactive numerical computations
What is Matlab? A software environment for interactive numerical computations Examples: Matrix computations and linear algebra Solving nonlinear equations Numerical solution of differential equations Mathematical
More informationIntroduction to Octave/Matlab. Deployment of Telecommunication Infrastructures
Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,
More informationA General Introduction to Matlab
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationMatlab Tutorial for COMP24111 (includes exercise 1)
Matlab Tutorial for COMP24111 (includes exercise 1) 1 Exercises to be completed by end of lab There are a total of 11 exercises through this tutorial. By the end of the lab, you should have completed the
More informationIntroduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College
Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationDSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab
Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have
More informationEng Marine Production Management. Introduction to Matlab
Eng. 4061 Marine Production Management Introduction to Matlab What is Matlab? Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is available
More informationMatlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square
Matlab Lecture 1 - Introduction to MATLAB Five Parts of Matlab MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse
More informationChapter 1 Introduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,
More informationGUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot
MATLAB Function Reference plot 2-D line plot GUI Alternatives Use the Plot Selector to graph selected variables in the Workspace Browser and the Plot Catalog, accessed from the Figure Palette. Directly
More informationGetting Started with Matlab
Chapter Getting Started with Matlab The computational examples and exercises in this book have been computed using Matlab, which is an interactive system designed specifically for scientific computation
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationSome elements for Matlab programming
Some elements for Matlab programming Nathalie Thomas 2018 2019 Matlab, which stands for the abbreviation of MATrix LABoratory, is one of the most popular language for scientic computation. The classical
More informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationIntroduction To MATLAB Introduction to Programming GENG 200
Introduction To MATLAB Introduction to Programming GENG 200, Prepared by Ali Abu Odeh 1 Table of Contents M Files 2 4 2 Execution Control 3 Vectors User Defined Functions Expected Chapter Duration: 6 classes.
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in
More informationIntroduction to Matlab
Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More informationIntroduction to MATLAB
Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following
More informationStarting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to.
Starting Matlab Go to MATLAB Laboratory 09/09/10 Lecture Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu http://ctx.loyola.edu and login with your Loyola name and password...
More informationLAB 1 General MATLAB Information 1
LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by
More informationSTAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006
STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics
More informationGetting started with MATLAB
Sapienza University of Rome Department of economics and law Advanced Monetary Theory and Policy EPOS 2013/14 Getting started with MATLAB Giovanni Di Bartolomeo giovanni.dibartolomeo@uniroma1.it Outline
More informationAn Introduction to MATLAB II
Lab of COMP 319 An Introduction to MATLAB II Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 2: 16th Sep, 2013 1 Outline of Lab 2 Review of Lab 1 Matrix in Matlab
More informationPROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More informationIntroduction to Matlab
What is Matlab? Introduction to Matlab Matlab is software written by a company called The Mathworks (mathworks.com), and was first created in 1984 to be a nice front end to the numerical routines created
More informationAMS 27L LAB #2 Winter 2009
AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles
More informationMatlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More informationIntroduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003
Introduction to MATLAB Computational Probability and Statistics CIS 2033 Section 003 About MATLAB MATLAB (MATrix LABoratory) is a high level language made for: Numerical Computation (Technical computing)
More informationMATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)
Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal
More informationA Quick Tutorial on MATLAB. Zeeshan Ali
A Quick Tutorial on MATLAB Zeeshan Ali MATLAB MATLAB is a software package for doing numerical computation. It was originally designed for solving linear algebra type problems using matrices. It's name
More informationMATLAB Tutorial III Variables, Files, Advanced Plotting
MATLAB Tutorial III Variables, Files, Advanced Plotting A. Dealing with Variables (Arrays and Matrices) Here's a short tutorial on working with variables, taken from the book, Getting Started in Matlab.
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 General considerations The aim of this laboratory is to review some useful MATLAB commands in digital signal processing. MATLAB is one of the fastest and most enjoyable ways
More informationIntroduction to MATLAB 7 for Engineers
PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for
More informationInlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS
Inlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS 1 6 3 Matlab 3.1 Fundamentals Matlab. The name Matlab stands for matrix laboratory. Main principle. Matlab works with rectangular
More informationIntroduction to MATLAB Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationMATLAB: The Basics. Dmitry Adamskiy 9 November 2011
MATLAB: The Basics Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 9 November 2011 1 Starting Up MATLAB Windows users: Start up MATLAB by double clicking on the MATLAB icon. Unix/Linux users: Start up by typing
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationELEN E3084: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals
ELEN E384: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals 1 Introduction In the last lab you learn the basics of MATLAB, and had a brief introduction on how vectors
More informationTable of Contents. Basis CEMTool 7 Tutorial
PREFACE CEMTool (Computer-aided Engineering & Mathematics Tool) is a useful computational tool in science and engineering. No matter what you background be it physics, chemistry, math, or engineering it
More informationQuick MATLAB Syntax Guide
Quick MATLAB Syntax Guide Some useful things, not everything if-statement Structure: if (a = = = ~=
More informationAn Introductory Tutorial on Matlab
1. Starting Matlab An Introductory Tutorial on Matlab We follow the default layout of Matlab. The Command Window is used to enter MATLAB functions at the command line prompt >>. The Command History Window
More informationIntroduction to Matlab
Introduction to Matlab What is Matlab? Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is available for PC's, Macintosh and UNIX systems.
More informationIntroduction to Scientific and Engineering Computing, BIL108E. Karaman
USING MATLAB INTRODUCTION TO SCIENTIFIC & ENGINEERING COMPUTING BIL 108E, CRN24023 To start from Windows, Double click the Matlab icon. To start from UNIX, Dr. S. Gökhan type matlab at the shell prompt.
More informationPC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.
PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationGrace days can not be used for this assignment
CS513 Spring 19 Prof. Ron Matlab Assignment #0 Prepared by Narfi Stefansson Due January 30, 2019 Grace days can not be used for this assignment The Matlab assignments are not intended to be complete tutorials,
More informationINTRODUCTION TO MATLAB
1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab
More informationMATLAB BEGINNER S GUIDE
MATLAB BEGINNER S GUIDE About MATLAB MATLAB is an interactive software which has been used recently in various areas of engineering and scientific applications. It is not a computer language in the normal
More information