ECE Lesson Plan - Class #3 Script M-files, Program Control, and Complex Numbers

Size: px
Start display at page:

Download "ECE Lesson Plan - Class #3 Script M-files, Program Control, and Complex Numbers"

Transcription

1 ECE Lesson Plan - Class #3 Script M-files, Program Control, and Complex Numbers Script M-files : A script file is an external file that contains a sequence of MATLAB. By typing the filename, subsequent MATLAB input is obtained from the file. Script files have a filename extension of.m and are often called M-files. Scripts are the simplest kind of M-file. They are useful for automating blocks of MATLAB commands, such as computations you have to perform repeatedly from the command line. Scripts can operate on existing data in the workspace, or they can create new data on which to operate. Although scripts do not return output arguments, any variables that they create remain in the workspace so you can use them in further computations. In addition, scripts can produce graphical output using commands like plot. Scripts can contain any series of MATLAB and require no declarations. Like any M-file, scripts can contain comments. Any text following a percent sign (%) on a given line is comment text. Comments can appear on lines by themselves, or you can app them to the of any executable line. Enter the word 'edit' at the MATLAB prompt to open the MATLAB Editor. fprintf Write formatted data to file or screen fprintf([fid],format,a,...) fprintf([fid], format,a,...) writes to file pointed to by FID which is obtained by fopen. If FID is omitted output is sent to standard output--the screen. The format string specifies notation, alignment, significant digits, field width, and other aspects of output format. It can contain ordinary alphanumeric characters; along with escape characters, conversion specifiers, and other characters, organized as shown below: Tables The following tables describe the non-alphanumeric characters found in format specification strings. Character \n New line 1

2 \t Horizontal tab \b Backspace \r Carriage return \f Form feed \\ Backslash \'' or '' (two single quotes) Single quotation mark %% Percent character Conversion characters specify the notation of the output. These characters are also known as specifiers. Specifier %c Single character %d Decimal notation (signed) %e Exponential notation (using a lowercase e as in e+00) %E Exponential notation (using an uppercase E as in E+00) %f Fixed-point notation %g The more compact of %e or %f, as defined in [2]. Insignificant zeros do not print. %G Same as %g, but using an uppercase E %o Octal notation (unsigned) %s String of characters %u Decimal notation (unsigned) %x Hexadecimal notation (using lowercase letters a-f) %X Hexadecimal notation (using uppercase letters A-F) Other characters can be inserted into the conversion specifier between the % and the conversion character. Character Example A minus sign (-) Left-justifies the converted argument in its field. %-5.2d A plus sign (+) Always prints a sign character (+ or -). %+5.2d Zero (0) Pad with zeros rather than spaces. %05.2d Digits (field width) A digit string specifying the minimum number of digits to be printed. %6f Digits (precision) A digit string including a period (.) specifying the number of digits to be printed to the right of the decimal point. %6.2f Examples The command >> fprintf('a unit circle has circumference %g.\n',2*pi) displays a line on the screen: A unit circle has circumference

3 To insert a single quotation mark in a string, use two single quotation marks together. For example, >> fprintf('it''s Friday.\n') displays on the screen: It's Friday. The commands >> B = [ ; ] >> fprintf('x is %6.2f meters or %8.3f mm\n',9.9,9900,b) display the lines: X is 9.90 meters or mm X is 8.80 meters or mm X is 7.70 meters or mm Explicitly convert MATLAB double-precision variables to integral values for use with an integral conversion specifier. For instance, to convert decimal to hexadecimal format: >> a = [ ]; >> whos % Notice that the class for a is double array. >> fprintf('%x\n',a) 6 A E 2C input Request user input : user_entry = input('prompt') user_entry = input('prompt','s') : The response to the input prompt can be any MATLAB expression, which is evaluated using the variables in the current workspace. user_entry = input('prompt') displays prompt as a prompt on the screen, waits for input from the keyboard, and returns the value entered in user_entry. Remarks: If you press the Return key without entering anything, input returns an empty matrix. I recomm leaving an "arrowhead" or "pointer" at the of your string. An example would be: >> Variable = input('please enter Yadda Yadda Yadda here -> '); 3

4 The white space to the left of the "arrowhed" or "pointer" will indicate to the user where the data needs to be entered. Like this: Example: >>TestInput=('Please enter in a value for the variable TestInput -> ') >> whos % Notice that TestInput is now in the MATLAB workspace. error Display error messages error('error_message') error('error_message') displays an error message and returns control to the keyboard. The error message contains the input string error_message. The error command has no effect if error_message is a null string. Examples The error command provides an error return from M-files. >> XX = 2; >> if XX == 2 >> error('wrong number') >> warning Display warning message warning('message') warning on warning off warning backtrace warning('message') displays the text 'message' as does the disp function, except that with warning, message display can be suppressed. warning off suppresses all subsequent warning messages. warning on re-enables them. warning backtrace is the same as warning on except that the file and line number that produced the warning are displayed. 4

5 pause Halt execution temporarily. pause pause(n) pause on pause off pause, by itself, causes M-files to stop and wait for you to press any key before continuing. pause(n) pauses execution for n seconds before continuing. pause on allows subsequent pause commands to pause execution. pause off ensures that any subsequent pause or pause(n) do not pause execution. >> pause(10) will pause the execution of the MATLAB program for 10 seconds. pause by itself should almost always be preceded with >> disp('press any key to continue.') so that the user knows that the MATLAB Command window is in a pause mode. 5

6 Program Control MATLAB supports standard program control functions including loops and conditionals. These may be used in script M-files or functions. Relational Operators < > <= >= == ~= Relational operations A < B A > B A <= B A >= B A == B A ~= B The relational operators are <,, >,, ==, and ~=. Relational operators perform element-by-element comparisons between two arrays. They return an array of the same size, with elements set to logical true (1) where the relation is true, and elements set to logical false (0) where it is not. The operators <,, >, and use only the real part of their operands for the comparison. The operators == and ~= test real and imaginary parts. The relational operators have precedence midway between the logical operators and the arithmetic operators. To test if two strings are equivalent, use strcmp, which allows vectors of dissimilar length to be compared. Examples If one of the operands is a scalar and the other a matrix, the scalar expands to the size of the matrix. For example, the two pairs of : >> X = 5; >> X >= [1 2 3; 4 5 6; ] >> X = 5*ones(3,3); >> X >= [1 2 3; 4 5 6; ] produce the same result: ans = Logical Operators Logical operations 6

7 A & B A B ~A The symbols &,, and ~ are the logical operators and, or, and not. They work element-wise on arrays, with 0 representing logical false (F), and anything nonzero representing logical true (T). The & operator does a logical and, the operator does a logical or, and ~A complements the elements of A. The function xor(a,b) implements the exclusive or operation. Truth tables for these operators and functions follow. Inputs and or xor not A B A&B A B xor(a,b) ~A The logical operators have the lowest precedence, with arithmetic operators and relational operators being evaluated first. The precedence for the logical operators with respect to each other is: 1. not has the highest precedence. 2. and and or have equal precedence, and are evaluated from left to right. Remarks The logical operators have M-file function equivalents, as shown: and A&B and(a,b) or A B or(a,b) not ~A not(a) Examples Here are two scalar expressions that illustrate precedence relationships for arithmetic, relational, and logical operators: >> 1 & >> 3 > 4 & 1 They evaluate to 1 and 0 respectively, and are equivalent to: >> 1 & (0 + 3) >> (3 > 4) & 1 Here are two examples that illustrate the precedence of the logical operators to each other: >> 1 0 & 0 % Should = 0 >> 0 & 0 1 % Should = 1 7

8 for Repeat a specific number of times for variable = expression The general format is for variable = expression statement... statement The columns of the expression are stored one at a time in the variable while the following, up to the, are executed. In practice, the expression is almost always of the form scalar : scalar, in which case its columns are simply scalars. The scope of the for statement is always terminated with a matching. Notice that the matrix 'a' uses the zeros function to preallocate the matrix to conserve memory: Create a Script M-File here called ForExample.m. >> n = 7; >> a = zeros(n) % Preallocate matrix >> for i = 1:n >> for j = 1:n >> a(i, j) = 1/(i+j) >> >> >> a Terminate for, while, switch, and if or indicate last index while expression % (or if, or for) 8

9 B = A(index:,index) is used to terminate for, while, and if. Without an statement, for, while, and if wait for further input. Each is paired with the closest previous unpaired for, while, or if. The command can also serve as the last index in an indexing expression. In that context, = (size(x,k)) when used as part of the kth index. Examples of this use are X(3:) and X(1,1:2:-1). When using to grow an array, as in X(+1)=5. Examples This example shows used with for and if. Indentation provides easier readability. for i = 1:n if a(i) == 0 a(i) = a(i) + 2; Here, is used in an indexing expression: >> A = [ ]; >> B = A(1,7:) In this example, B is a 1-by-3 vector equal to [7 8 9]. if Conditionally execute if expression if expression1 elseif expression2 else if conditionally executes. The simple form is: if expression 9

10 More complicated forms use else or elseif. Each if must be paired with a matching. Arguments A MATLAB expression, usually consisting of smaller expressions or variables joined by relational operators (==, <, >, <=, >=, or ~=). Two examples are: expression count < limit and (height - offset) >= 0. Expressions may also include logical functions, as in: isreal(a). Simple expressions can be combined by logical operators (&,,~) into compound expressions such as: (count < limit) & ((height - offset) >= 0). One or more MATLAB to be executed only if the expression is true (or nonzero). See Examples for information about how nonscalar variables are evaluated. Expressions are evaluated as false unless every element-wise comparison evaluates as true. Thus, given matrices A and B: A = B = The expression: A < B Evaluates as false Since A(1,1) is not less than B(1,1). A < (B+1) Evaluates as true Since no element of A is greater than the corresponding element of B. A & B Evaluates as false Since A(1,2) B(1,2) is false. 5 > B Evaluates as true Since every element of B is less than 5. else Conditionally execute if expression else The else command is used to delineate an alternate block of. if expression else 10

11 The second set of is executed if the expression has any zero elements. The expression is usually the result of expression rop expression where rop is ==, <, >, <=, >=, or ~=. elseif Conditionally execute if expression elseif expression The elseif command conditionally executes. if expression elseif expression The second block of executes if the first expression has any zero elements and the second expression has all nonzero elements. The expression is usually the result of expression rop expression where rop is ==, <, >, <=, >=, or ~=. else if, with a space between the else and the if, differs from elseif, with no space. The former introduces a new, nested, if, which must have a matching. The latter is used in a linear sequence of conditional with only one terminating. The two segments if A if A x = a x = a else elseif B if B x = b x = b elseif C else x = c if C else x = c x = d else x = d 11

12 produce identical results. Exactly one of the four assignments to x is executed, deping upon the values of the three logical expressions, A, B, and C. Examples Here is an example showing if, else, and elseif: Create a Script M-File here called ElseIfExample.m: >> for i = 1:8 >> for j = 1:8 >> if i == j >> a(i,j) = 2; >> elseif abs([i j]) == 1 >> a(i,j) = 1; >> else >> a(i,j) = 0; >> >> >> while Repeat an indefinite number of times while expression while repeats an indefinite number of times. The are executed while the real part of expression has all nonzero elements. expression is usually of the form expression rop expression where rop is ==, <, >, <=, >=, or ~=. The scope of a while statement is always terminated with a matching. break Terminate execution of for or while loop break 12

13 break terminates the execution of for and while loops. In nested loops, break exits from the innermost loop only. Examples The indented are repeatedly executed until nonpositive n is entered. Create a Script M-File here called BreakExample.m >> while 1 >> n = input('enter n. n <= 0 quits. n = ') >> if n <= 0,break, >> r = (magic(n)) >> >> disp('breakexample.m has stopped.') % How many iterations required for a Binary Search on a given number? Create a Script M-File here called BinarySearch.m >> BinSrch = input('please input any number -> '); >> COUNTER = 1; >> for i = 1:1000 % Assume "Binary Search" is < >> BinSrch = BinSrch/2; >> if BinSrch <= 1 >> break >> >> COUNTER = COUNTER + 1; >> >> COUNTER 13

14 Functions for Complex Numbers i,j Imaginary Unit i x+yi x+i*y As the basic imaginary unit sqrt(-1), i is used to enter complex numbers. Since i is a built-in value of sqrt(-1), it can be overridden and used as a variable. This permits you to use i as an index in for loops, etc. If desired, use the character i without a multiplication sign as a suffix in forming a complex numerical constant. You can also use the character j as the imaginary unit as if it were i. >> i >> j Let's prove that, for example, the expressions 3+2i, 3+2*i, 3+2i, 3+2*j and 3+2*sqrt(-1) all have the same value. >> 3+2i >> 3+2*i >> 3+2j >> 3+2*j >> 3+2*sqrt(-1) % Changing from rectangular coordinates to polar coordinates. >> X = 3; >> Y = 4; >> R = abs(x+i*y); >> THETA = angle(x+i*y); >> R*exp(i*THETA) % Notice that the output here is rectangular. For complex Z = X + i*y, exp returns the complex exponential. Or said in a question: Does EXP(Z) = EXP(X)*(COS(Y)+i*SIN(Y))? >> X = 5; >> Y = 5; >> Z = X + Y*i >> exp(z) - (exp(x)*(cos(y)+i*sin(y))) 14

15 % If this equals 0 then the two sides of the equation are equal. real Real part of complex number X = real(z) X = real(z) returns the real part of the elements of the complex number Z. >> real(2+3*i) >> Z >> real(z) >> R*exp(i*THETA) >> real(r*exp(i*theta)) imag Imaginary part of a complex number Y = imag(z) Y = imag(z) returns the imaginary part of the elements of complex number Z. >> imag(2+3i) >> Z >> imag(z) >> R*exp(i*THETA) >> imag(r*exp(i*theta)) abs Complex Magnitude Y = abs(x) 15

16 abs(x) returns the complex modulus (magnitude): abs(x) = sqrt(real(x).^2 + imag(x).^2) Examples >> abs(3+4i) >> abs(2+2i) >> abs(1+i) Notice that the multiplication sign(*) is not necessary for "i" if the factor is first. angle Phase angle P = angle(z) P = angle(z)returns the phase angle(s), in radians, of complex number Z. To convert complex Z (in rectangular form -> x + iy) to polar form, solve for the magnitude and phase by using: >> R = abs(z) % The magnitude of complex number Z. (FYI - this value is unitless) >> theta = angle(z) % The phase angle, in radians, of complex number The conversion that is taking place is as follows: Z = X +(Y*i) = R.*exp(i*theta) Algorithm angle is calculated using: angle(z) = atan2(imag(z),real(z)) >> ZZ = [1+i 4-9i 3+8i 2-5i; 2+2i 6-8i 5+4i 4-i; 8+7i 6-6i 7+7i 5-5i; 9+i 8-2i 7+3i 6-4i] >> Theta = angle(zz) >> D = Theta * % 1 Radian = Degrees conj Complex conjugate ZC = conj(z) 16

17 ZC = conj(z) returns the complex conjugate of the elements of Z. Algorithm If Z is a complex number of the form X + iy or R*exp(iTHETA): conj(z) = real(z) - i*imag(z) >> ZZ >> conj(zz) >> RR = 5; >> THETA1 = ; >> CP = RR*exp(i*THETA1) % Notice that Cartesian (rectangular) coordinates are returned. >> conj(cp) >> CPneg = RR*exp(-i*THETA1) >> conj(cpneg) ctranspose ' Complex conjugate transpose. X' is the complex conjugate transpose of X. B = CTRANSPOSE(A) is called for the syntax A' that results in the complex conjugate transpose of A. >> CP' >> ctranspose(cp) >> W = [7+9i 5-6i 3+4i 7-6i] >> W' % Conjugate and Transpose >> W.' % Only Transposes >> ctranspose(w) % Equals W' cart2pol CART2POL Transform Cartesian to polar coordinates. [THETA,R] = CART2POL(X,Y) transforms corresponding elements of data stored in Cartesian coordinates X,Y to polar coordinates (angle θ and radius R). The arrays X and Y must be the same size (or either can be scalar). θ is returned in radians. [THETA,R] = cart2pol(x,y) 17

18 [THETA,R] = cart2pol(x,y)transforms two-dimensional Cartesian coordinates stored in corresponding elements of arrays X and Y into polar coordinates. Examples >> X = 3; % The Real Part >> Y = 4; % The Imaginary Part >> [THETA, R] = cart2pol(x,y) >> X = 1; >> Y = 1; >> [THETA, R] = cart2pol(x,y) >> THETA * pol2cart Transform polar coordinates to Cartesian coordinates. [X,Y] = pol2cart(theta,r) [X,Y] = pol2cart(theta,r) transforms the polar coordinate data stored in corresponding elements of THETA and R (magnitude) to 2-dimensional Cartesian, or x-y, coordinates. The arrays THETA and R must be the same size (or either can be scalar). The values in THETA must be in radians. >> [X,Y] = pol2cart( ,5) >> [X,Y] = pol2cart(pi/4,5.6569) % Factors of pi work best for phase inputs. polar Plot polar coordinates polar(theta,r) polar(theta,r,linespec) The polar function accepts polar coordinates, plots them in a Cartesian plane, and draws the polar grid on the plane. polar(theta,r) creates a polar coordinate plot of the angle theta versus the radius r. theta is the angle from the x-axis to the radius vector specified in radians; r is the length of the radius vector specified in dataspace units. 18

19 polar(theta,rho,linespec) LineSpec specifies the line type, plot symbol, and color for the lines drawn in the polar plot. Create a simple polar plot using a dashed, red line: >> t1 = 0:.01:2*pi; >> polar(t1,sin(2*t1).*cos(2*t1),'--r') >> hold on >> polar(t1+0.25,sin(2*t1).*cos(2*t1),'*b') >> polar(t1+0.5,sin(2*t1).*cos(2*t1),'.-g') References: - The MathWorks, Inc. Online (Helpdesk) Documentation by The MathWorks, Inc. - Mastering MATLAB 5 by Duane Hanselman and Bruce Littlefield - Engineering Problem Solving with MATLAB by D.M. Etter - Using MATLAB Version 5.0 by The MathWorks, Inc. - Getting Started with MATLAB Version 5.0 by The MathWorks, Inc. 19

Scalars and Variables

Scalars and Variables Chapter 2 Scalars and Variables In this chapter, we will discuss arithmetic operations with scalars (numbers, really an array with only one element) and variables. Scalars can be used directly in calculations

More information

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

Experiment 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 information

Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999

Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 1999 by CRC PRESS LLC CHAPTER THREE CONTROL STATEMENTS 3.1 FOR

More information

Introduction to MATLAB

Introduction 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 information

C/C++ Programming for Engineers: Matlab Branches and Loops

C/C++ Programming for Engineers: Matlab Branches and Loops C/C++ Programming for Engineers: Matlab Branches and Loops John T. Bell Department of Computer Science University of Illinois, Chicago Review What is the difference between a script and a function in Matlab?

More information

Programming in Mathematics. Mili I. Shah

Programming 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 information

ECE Lesson Plan - Class 1 Fall, 2001

ECE Lesson Plan - Class 1 Fall, 2001 ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not

More information

Programming 1. Script files. help cd Example:

Programming 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 information

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Introduction 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 information

Files and File Management Scripts Logical Operations Conditional Statements

Files and File Management Scripts Logical Operations Conditional Statements Files and File Management Scripts Logical Operations Conditional Statements Files and File Management Matlab provides a group of commands to manage user files pwd: Print working directory displays the

More information

An Introduction to MATLAB

An Introduction to MATLAB An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of

More information

MATLAB Introduction to MATLAB Programming

MATLAB 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 information

Compact Matlab Course

Compact Matlab Course Compact Matlab Course MLC.1 15.04.2014 Matlab Command Window Workspace Command History Directories MLC.2 15.04.2014 Matlab Editor Cursor in Statement F1 Key goes to Help Information MLC.3 15.04.2014 Elementary

More information

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices

Introduction 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 information

Introduction to MATLAB

Introduction 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 information

Chapter 7: Programming in MATLAB

Chapter 7: Programming in MATLAB The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming (ECIV 2302) Chapter 7: Programming in MATLAB 1 7.1 Relational and Logical Operators == Equal to ~=

More information

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

Constraint-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 information

Chapter 3: Programming with MATLAB

Chapter 3: Programming with MATLAB Chapter 3: Programming with MATLAB Choi Hae Jin Chapter Objectives q Learning how to create well-documented M-files in the edit window and invoke them from the command window. q Understanding how script

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced

More information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

Quick MATLAB Syntax Guide

Quick MATLAB Syntax Guide Quick MATLAB Syntax Guide Some useful things, not everything if-statement Structure: if (a = = = ~=

More information

Programming in MATLAB

Programming in MATLAB 2. Scripts, Input/Output and if Faculty of mathematics, physics and informatics Comenius University in Bratislava October 7th, 2015 Scripts Scripts script is basically just a sequence of commands the same

More information

A Guide to Using Some Basic MATLAB Functions

A 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 information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features

More information

Relational and Logical Statements

Relational and Logical Statements Relational and Logical Statements Relational Operators in MATLAB A operator B A and B can be: Variables or constants or expressions to compute Scalars or arrays Numeric or string Operators: > (greater

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

Importing and Exporting Data

Importing and Exporting Data Class14 Importing and Exporting Data MATLAB is often used for analyzing data that was recorded in experiments or generated by other computer programs. Likewise, data that is produced by MATLAB sometimes

More information

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.

12 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 information

Laboratory 1 Octave Tutorial

Laboratory 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 information

Matlab Programming Arrays and Scripts 1 2

Matlab Programming Arrays and Scripts 1 2 Matlab Programming Arrays and Scripts 1 2 Mili I. Shah September 10, 2009 1 Matlab, An Introduction with Applications, 2 nd ed. by Amos Gilat 2 Matlab Guide, 2 nd ed. by D. J. Higham and N. J. Higham Matrix

More information

MATLAB. MATLAB Review. MATLAB Basics: Variables. MATLAB Basics: Variables. MATLAB Basics: Subarrays. MATLAB Basics: Subarrays

MATLAB. MATLAB Review. MATLAB Basics: Variables. MATLAB Basics: Variables. MATLAB Basics: Subarrays. MATLAB Basics: Subarrays MATLAB MATLAB Review Selim Aksoy Bilkent University Department of Computer Engineering saksoy@cs.bilkent.edu.tr MATLAB Basics Top-down Program Design, Relational and Logical Operators Branches and Loops

More information

An Introductory Tutorial on Matlab

An 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 information

CSE 123. Lecture 9. Formatted. Input/Output Operations

CSE 123. Lecture 9. Formatted. Input/Output Operations CSE 123 Lecture 9 Formatted Input/Output Operations fpintf function writes formatted data in a user specified format to a file fid fprintf Function Format effects only the display of variables not their

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

Mini-Matlab Lesson 5: Functions and Loops

Mini-Matlab Lesson 5: Functions and Loops Mini-Matlab Lesson 5: Functions and Loops Writing Functions and Scripts Contents Relational and logical operators IF loops FOR loops WHILE loops Scripts and functions Defining and using functions Anonymous

More information

Control Structures. March 1, Dr. Mihail. (Dr. Mihail) Control March 1, / 28

Control Structures. March 1, Dr. Mihail. (Dr. Mihail) Control March 1, / 28 Control Structures Dr. Mihail March 1, 2015 (Dr. Mihail) Control March 1, 2015 1 / 28 Overview So far in this course, MATLAB programs consisted of a ordered sequence of mathematical operations, functions,

More information

ENGR 1181 MATLAB 05: Input and Output

ENGR 1181 MATLAB 05: Input and Output ENGR 1181 MATLAB 05: Input and Output Learning Objectives 1. Create a basic program that can be used over and over or given to another person to use 2. Demonstrate proper use of the input command, which

More information

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

Appendix 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 information

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.

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. 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 information

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual Ordinary Differential Equation Solver Language (ODESL) Reference Manual Rui Chen 11/03/2010 1. Introduction ODESL is a computer language specifically designed to solve ordinary differential equations (ODE

More information

Introduction to MATLAB for Numerical Analysis and Mathematical Modeling. Selis Önel, PhD

Introduction to MATLAB for Numerical Analysis and Mathematical Modeling. Selis Önel, PhD Introduction to MATLAB for Numerical Analysis and Mathematical Modeling Selis Önel, PhD Advantages over other programs Contains large number of functions that access numerical libraries (LINPACK, EISPACK)

More information

SECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing

SECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing SECTION 5: STRUCTURED PROGRAMMING IN MATLAB ENGR 112 Introduction to Engineering Computing 2 Conditional Statements if statements if else statements Logical and relational operators switch case statements

More information

Lecture 1: Hello, MATLAB!

Lecture 1: Hello, MATLAB! Lecture 1: Hello, MATLAB! Math 98, Spring 2018 Math 98, Spring 2018 Lecture 1: Hello, MATLAB! 1 / 21 Syllabus Instructor: Eric Hallman Class Website: https://math.berkeley.edu/~ehallman/98-fa18/ Login:!cmfmath98

More information

PC-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. 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 information

Introduction to MATLAB

Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming

More information

Chapter 1 Introduction to MATLAB

Chapter 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 information

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

function [s p] = sumprod (f, g) Outline of the Lecture Introduction to M-function programming Matlab Programming Example Relational operators Logical Operators Matlab Flow control structures Introduction to M-function programming M-files:

More information

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed MATLAB Constants, Variables & Expression Introduction MATLAB can be used as a powerful programming language. It do have IF, WHILE, FOR lops similar to other programming languages. It has its own vocabulary

More information

A QUICK INTRODUCTION TO MATLAB

A QUICK INTRODUCTION TO MATLAB A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Basic operations and a few illustrations This set is independent from rest of the class notes. Matlab will be covered in recitations and occasionally

More information

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018) Introduction to MATLAB Programming Chapter 3 Linguaggio Programmazione Matlab-Simulink (2017/2018) Algorithms An algorithm is the sequence of steps needed to solve a problem Top-down design approach to

More information

ECE 3793 Matlab Project 1

ECE 3793 Matlab Project 1 ECE 3793 Matlab Project 1 Spring 2017 Dr. Havlicek DUE: 02/04/2017, 11:59 PM Introduction: You will need to use Matlab to complete this assignment. So the first thing you need to do is figure out how you

More information

A QUICK INTRODUCTION TO MATLAB. Intro to matlab getting started

A QUICK INTRODUCTION TO MATLAB. Intro to matlab getting started A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Intro to matlab getting started Basic operations and a few illustrations This set is indepent from rest of the class notes. Matlab will be covered

More information

Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011

Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011 Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011 Autumn 2015 Lecture 3, Simple C programming M. Eriksson (with contributions from A. Maki and

More information

Chapters covered for the final

Chapters covered for the final Chapters covered for the final Chapter 1 (About MATLAB) Chapter 2 (MATLAB environment) Chapter 3 (Built in Functions):3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.8, 3.9 Chapter 4 (Manipulating Arrays):4.1,4.2, 4.3

More information

What is MATLAB and howtostart it up?

What is MATLAB and howtostart it up? MAT rix LABoratory What is MATLAB and howtostart it up? Object-oriented high-level interactive software package for scientific and engineering numerical computations Enables easy manipulation of matrix

More information

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

MATLAB 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 information

Some elements for Matlab programming

Some 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 information

Getting started with MATLAB

Getting 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 information

Lecturer: Keyvan Dehmamy

Lecturer: 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 information

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming 1 Literal Constants Definition A literal or a literal constant is a value, such as a number, character or string, which may be assigned to a variable or a constant. It may also be used directly as a function

More information

ECE 202 LAB 3 ADVANCED MATLAB

ECE 202 LAB 3 ADVANCED MATLAB Version 1.2 1 of 13 BEFORE YOU BEGIN PREREQUISITE LABS ECE 201 Labs EXPECTED KNOWLEDGE ECE 202 LAB 3 ADVANCED MATLAB Understanding of the Laplace transform and transfer functions EQUIPMENT Intel PC with

More information

Desktop Command window

Desktop Command window Chapter 1 Matlab Overview EGR1302 Desktop Command window Current Directory window Tb Tabs to toggle between Current Directory & Workspace Windows Command History window 1 Desktop Default appearance Command

More information

MORE MATLAB. MATLAB variables

MORE MATLAB. MATLAB variables MORE MATLAB This lab experience assumes that you have a basic grasp of the principles in the first tutorial. You will gain some further hands-on experience with some of the core functionality of MATLAB

More information

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

The Mathcad Workspace 7

The Mathcad Workspace 7 For information on system requirements and how to install Mathcad on your computer, refer to Chapter 1, Welcome to Mathcad. When you start Mathcad, you ll see a window like that shown in Figure 2-1. By

More information

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated

More information

Digital Image Analysis and Processing CPE

Digital Image Analysis and Processing CPE Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors

More information

Scientific Computing with MATLAB

Scientific Computing with MATLAB Scientific Computing with MATLAB Dra. K.-Y. Daisy Fan Department of Computer Science Cornell University Ithaca, NY, USA UNAM IIM 2012 2 Focus on computing using MATLAB Computer Science Computational Science

More information

MATLAB Introductory Course Computer Exercise Session

MATLAB Introductory Course Computer Exercise Session MATLAB Introductory Course Computer Exercise Session This course is a basic introduction for students that did not use MATLAB before. The solutions will not be collected. Work through the course within

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms

More information

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

Introduction 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 information

Math 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau)

Math 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) January 24, 2010 Starting Under windows Click on the Start menu button

More information

VLC : Language Reference Manual

VLC : Language Reference Manual VLC : Language Reference Manual Table Of Contents 1. Introduction 2. Types and Declarations 2a. Primitives 2b. Non-primitives - Strings - Arrays 3. Lexical conventions 3a. Whitespace 3b. Comments 3c. Identifiers

More information

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

INTRODUCTION 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 information

Introduction to MATLAB Programming

Introduction to MATLAB Programming Spring 2019 Spring 2019 1 / 17 Introduction Algorithm An algorithm is a sequence of steps needed to solve a problem. We will use MATLAB to develop algorithms to solve specific problems. The basic algorithm

More information

Laboratory 1 Introduction to MATLAB for Signals and Systems

Laboratory 1 Introduction to MATLAB for Signals and Systems Laboratory 1 Introduction to MATLAB for Signals and Systems INTRODUCTION to MATLAB MATLAB is a powerful computing environment for numeric computation and visualization. MATLAB is designed for ease of use

More information

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1 NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.

More information

Eng Marine Production Management. Introduction to Matlab

Eng 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 information

7 Control Structures, Logical Statements

7 Control Structures, Logical Statements 7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,

More information

Introduction to Matlab. By: Hossein Hamooni Fall 2014

Introduction 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 information

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

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

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

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3. MATLAB Introduction Accessing Matlab... Matlab Interface... The Basics... 2 Variable Definition and Statement Suppression... 2 Keyboard Shortcuts... More Common Functions... 4 Vectors and Matrices... 4

More information

Introduction to C Language

Introduction to C Language Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,

More information

MATLAB Laboratory 10/07/10 Lecture. Chapter 7: Flow Control in Programs

MATLAB Laboratory 10/07/10 Lecture. Chapter 7: Flow Control in Programs MATLAB Laboratory 10/07/10 Lecture Chapter 7: Flow Control in Programs Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 10/07/10

More information

Introduction to Python Programming

Introduction to Python Programming 2 Introduction to Python Programming Objectives To understand a typical Python program-development environment. To write simple computer programs in Python. To use simple input and output statements. To

More information

Chapter 4: Programming with MATLAB

Chapter 4: Programming with MATLAB Chapter 4: Programming with MATLAB Topics Covered: Programming Overview Relational Operators and Logical Variables Logical Operators and Functions Conditional Statements For Loops While Loops Debugging

More information

CMAT Language - Language Reference Manual COMS 4115

CMAT Language - Language Reference Manual COMS 4115 CMAT Language - Language Reference Manual COMS 4115 Language Guru: Michael Berkowitz (meb2235) Project Manager: Frank Cabada (fc2452) System Architect: Marissa Ojeda (mgo2111) Tester: Daniel Rojas (dhr2119)

More information

Stokes Modelling Workshop

Stokes Modelling Workshop Stokes Modelling Workshop 14/06/2016 Introduction to Matlab www.maths.nuigalway.ie/modellingworkshop16/files 14/06/2016 Stokes Modelling Workshop Introduction to Matlab 1 / 16 Matlab As part of this crash

More information

McTutorial: A MATLAB Tutorial

McTutorial: A MATLAB Tutorial McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB

More information

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */ Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,

More information

INTRODUCTION TO MATLAB

INTRODUCTION 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 information

MATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano

MATLAB 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 information

18.02 Multivariable Calculus Fall 2007

18.02 Multivariable Calculus Fall 2007 MIT OpenCourseWare http://ocw.mit.edu 18.02 Multivariable Calculus Fall 2007 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.02 Problem Set 4 Due Thursday

More information

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O Overview of C Basic Data Types Constants Variables Identifiers Keywords Basic I/O NOTE: There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators.

More information

Arithmetic operations

Arithmetic operations Arithmetic operations Add/Subtract: Adds/subtracts vectors (=> the two vectors have to be the same length). >> x=[1 2]; >> y=[1 3]; >> whos Name Size Bytes Class Attributes x 1x2 16 double y 1x2 16 double

More information

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

Prof. Manoochehr Shirzaei. RaTlab.asu.edu RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files

More information

MATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations

MATLAB 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 information

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

Outline. 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 information

Chapter 8 Complex Numbers & 3-D Plots

Chapter 8 Complex Numbers & 3-D Plots EGR115 Introduction to Computing for Engineers Complex Numbers & 3-D Plots from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: Complex Numbers & 3-D

More information