Variable names are an example of an identifier name: The name must begin with a letter of the alphabet Using mixed case can solve some problems with

Size: px
Start display at page:

Download "Variable names are an example of an identifier name: The name must begin with a letter of the alphabet Using mixed case can solve some problems with"

Transcription

1 Chapter 1 Gui basically just a bunch of boxes that has been created by code % represents a comment. Does not actually do anything. Just helps you make more sense of the program Loop -when you do things repeatedly 1,2,3,4,repeat.. While command Sets up a loop Follow up by a true false statement. True repeats the loop False ends the loop Anything in a parenthesis represents a function can be named anything "function" does not actually do anything "disp" displays a message "mod" create a clock arithmetic 10,11,12,1,2.etc. No semicolon means an answer will be given =@ anonymous function ~ means not. Negates the function to mean the opposite "diary" starts a recording of the program "diary off" ends the recording "more" shows you more of a file Assignment statement Left side is the name of the variable Right side is the expression 'who' - lists out all of your variables Scripts - groups of commands that are executed sequentially >> = prompt Enter commands or expressions here and MATLAB will produce a result Programs - things contained in script files Commands: >>Demo - brings up examples in the Help browser >>Help - explains a function >>lookfor - searches help for specific words or phrases >>doc - brings up a documentation page in the help browser >>quit/exit - exits MATLAB Variable - a way to store a value in MATLAB Create variables using assignment statements Variable is on the left "=" = the assignment operator >> X = 6 X 6 >> ; at the end of the statement suppresses the output "ans" the variable that will be stored from the most recent arithmetic done Not a good idea to use "ans" as a defined variable Use the up arrow as a shortcut to retype commands

2 Variable names are an example of an identifier name: The name must begin with a letter of the alphabet Using mixed case can solve some problems with underscores Ex: TylerHahn Store variables as names that make sense as to what that variable is >>Who - shows the variables that have been assigned answers >>Clear - clears out all variables so they no longer exist >>Clear VariableName - clears out the specific variable Double click on a variable in the workspace to modify components Types Numbers Single precision - stores less numbers in a decimal place Double precision - stores more numbers in a decimal place Integer types Int8, int16, int32, int64 Represents the number of bits(characters in this case) that will be used Uint(8,16,32,64) Unsigned integer types(will always be positive) Char- used to store single characters or Strings - a sequence of characters Both characters and strings are in closed in single quotes '123 ' Logical - used to store true false values Changing format Numbers Short - the standard format for numbers, will display to four decimal places Long - display 15 decimal places Spacing Loose - empty lines between lines of code Compact - no empty lines For long commands use an ellipsis( ) to continue the command to the next line Operators Unary - operate on a single value Binary - operate on two values Operator precedence rules Same rules as you are used to in math remember PEMDAS In order of precedence: () parentheses ^ exponentiation - negation */\ multiplication and division +- addition and subtraction Calling a function The name of the function is given followed by the argument(s) in parenthesis Tab completion If you type the beginning characters in the name of a function and hit tab A list of functions that contain the letters will pop up Constants NaN - Not a Number

3 Random numbers >>rand(n,m) Gives a random number between the interval n to m The default interval for random numbers is (0,1) >>randn Normally distributed random real numbers >>randi Random integer Imin = integer min Imax = integer max >>Randi(n) Returns an integer in the interval (0,n) >>rng Sets the seed for Random number generator Characters and Strings Represented using single quotes ex: 'a' No quotes would denote a variable assignment '3' is a character 3 is a number Strings - sequences of numbers 128 different characters Relational expressions Expressions that are either true or false Sometimes called boolean expressions or logical expressions Regional operators - relate two expressions > < >= <= == ~= True = 1 = logical(1) False = 0 = logical(0) >>xor Exclusive or function Returns 'true' if one and only one of the statements are true >> Short circuit operations If the first statement it true it will respond with a true response without even looking at the second statement Type Ranges and Type Casting >>intmin Set the smallest possible integer >>intmax Sets the largest possible integer Casting Converts the type 'like' - changes one variable type to another variable type >>numequiv = ' '

4 Give the numerical equivalent of the character >>char Does the opposite and gives the character after inputting a number >>double Doubles the character value of everything put in as the assignment Built in numerical functions >>rem (#,#) Gives the remainder after dividing two numbers >>sign (#) Gives the sign of the number inputted >>round (#) Rounds a number to the specified number of digits >>nthroot (64, 3) Takes the cube root of 64 >>sqrt Square root >>log(x) Returns the natural logarithm >>log2(x) Returns the base 2 logarithm >>log10(x) Returns the base 10 logarithm >>exp(n) Returns the constant e^n >>deg2rad Converts degrees to radians >>rad2deg Converts radians to degrees Class notes >>rad = input('radius = '); >>area = pi * (rad^2) >>fprintf('the area of radius %f is %f \n', rad, area) The first %f refers to the first variable listed The second %f refers to the second variable listen Chapter 2 Vectors and matrices Row vector 1 x n Column vector N x 1 Elements The numbers inside of the matrix Array Will often be used interchangeably with the word matrix Creating row vectors

5 >>'name of matrix' = [ ] Colon operator(:) can be used to iterate through values >> v = 3:5 V = A step value can also be assigned using another colon >>v = 0:4:12 V = Matrix goes from 0-12 in increments of 4 Linspace Create a linearly spaced vector with n values Ls = linspace(x,y,n) X = min value Y = max value N = number of values in between Logspace Creates a logarithmically spaced vector >>logspace(x,y,n) X = 10^x Y = 10^y N = number of elements Vector variables can be created using existing variables >>newvec = [2 4 8 V] Newvec = >>newvec (n) Tells you the value in the n th element of the vector >>b = newvec(4:6) B = >>newvec([1 3 5]) This gives the first third and fifth elements in the matrix Changing an element >>b(1) = 2 The first element in b is now 2 Adding an element >>b(4) = 5 The new matrix is now If a element is skipped it will automatically get filled in with zeros Creating column vectors Use semicolons to separate rows >>c = [1; 2; 3; 4] C = 1 2 3

6 4 Any row vector can be transposed using an apostrophe >>r=1:3; >>c = r' C = Creating matrix variable >>mat = [4 3 1; 2 5 6] Mat = Random matrices can be created that are n x n >>rand(2) Creates a 2 x 2 matrix with random numbers >>rand(n,m) Creates a n X m matrix with random values >>randi ( [0, 10], 3, 3) Randi - random integer matrix [0, 10] - defines the range of popular integers 3, 3 - states it is a 3 x 3 matrix Can create a 0 matrix or a 1 matrix using the commands >>zeros(r, c) >>ones(r, c) Referring to and modifying elements of a matrix >>mat = [2:4; 3:5] Mat = >>mat(2,3) Ans = 5 >>mat(1:2, 2:3) Ans: :2 - calls the rows 1-2 2:3 - calls the columns 3-4 >>mat(1,:) Ans = calls the first row only : - calls all columns >>mat(1,2) = 11 Mat=

7 Changes one specific element >>mat (2,:) = 5:7 Mat= >>m = randi ([10 50], 3,5) M = %creating a random matrix% >>m(2:3, 3:5) = 3 M = This demonstrates how to change an entire subsection of a matric to a new value >>mat(:,4) = [9 2]' Mat = This demonstrates how to add a new column the same could be done with a row Dimensions Mat = >>length( ) Returns the number of rows or columns in a vector, whichever is largest >>size( ) Returns the size of the vector >>[r, c] = size(mat) R = 3 C = 2 This returned the Rows x Columns then saved those vectors as the variables R and C >>numel(mat) Ans= 6 Returns the total number of elements in the vector End - refers to the last element in either the row or column >>mat(end,1) Ans = 3 >>mat(1,end) Ans = 5 Changing dimensions

8 >>reshape(mat,r,c) Reshapes the matrix to the new column and row dimensions maintaining element position in that matrix >>fliplr(mat) Flips the matrix left and right. First column becomes last etc. >>flipup(mat) Flips the matrix up and down. First row becomes last etc. >>flip Used on vectors to switch >>rot90(mat) Rotates the vector 90 degrees clockwise >>repmat(mat,r,c) Replicates a matrix and plugs the old matrix into the new matrix >>repelem(mat,r,c) Replicates a matrix in the new dimensions specified Empty Vectors An empty vector can be created using square brackets >>evec = [] >>evec = [evec 4] This will add 4 to the empty vector >>evec = 4 >>evec = [evec 11] >>evec = 4 11 Three dimensional matrices Make sure you have the same rxc dimensions for the three dimensional layers >>layerone = reshape(1:15,3,5) Layerone = Most matrices are going to be two dimensional so don't worry about this too much Vectors and Matrices as function arguments An entire matrix can be passed to a function as an argument Vec = -2:1 Vec = >>absvec = abs(vec) Absvec= >>min Will return the smallest value in a vector(each column) >>max Returns the largest value in a vector( each column) >>sum

9 Adds up all the elements in a matrix >>prod Returns the product off all elements in a matrix >>cumsum Cumulative sum. Basically just shows all the steps it take to calculate >>sum >>cumprod Same as cumsum but for multiplication >>diff Returns the difference between consecutive elements of a vector Scalar and array operations on vectors and matrices >>v = [ ]; >>v = v * 3 V= [ ] "." is a way of saying to do operations on vectors term by term Logical vectors Logical vectors use rational expression that result in true/false values Relational expressions with vectors and matrices When using <,>,== the result will be a logical output True and false commands can be used to create 0 matrices and 1 matrices Matrix multiplication This is not multiplying term by term The columns of the first one must equal the rows of the second >>dot(vec1,vec2) How to code in a dot product >>cross(vec1,vec2) How to use the cross product on a set of vectors Chapter 3 Scripts - a chain of commands Algorithms - A sequence of steps used to solve the problem Top-down design - taking big tasks and breaking them down into small manageable tasks Prompting - telling the user they need to enter something For most programs the basic algorithm is a. Get the inputs b. Calculate the results c. Display the results Matlab Scripts Following a list of commands sequentially Compiler - the program that takes stuff from a high level language like MATLAB and convert it to a computer language Source code - the code you actually type Object code - the code that is used by the complier Creating a new script Click on "new script" under the home tab Moving from command window to a script Select commands in command window

10 Right click Click either script or live script % - allows you to enter comments on your matlab script and it will not be read when the program is executed Insert a space after the first line of the function to allow a 'help' command to make sense Input and Output Delimeters - general statement for punctuation marks %f is a string %d is a number >>Variable = input('some stuff') 's' allows you to enter strings into an input function Blank spaces before a character are stored as part of that string Serarate input statements are necessary if more than one input is desired >>disp(variable) Displays the variable without formating >>fprintf('words %f', variable) \n starts the command on the next line Use after the %f or %d in the fprintf command %d = integer %f = float real number %c = character %s = string of characters %#f The # is how many chracters it will be %5.3f Five digits with three decimal places Printing a vector Vec = 2:5; Fprintf('%d', vec) Fprintf('\n') Disp may work better for matrices because it displays it the way it should look and not with linear indexing Scripts to produce and customize simple plots Creating a plot is much easier in a script than from just the command window >>clf - clears everything from the figure window >>Figure - creates a new empty figure window >>hold - prevents creating a new plot. Points will continue to be placed on the current one >>legend - displays strings given to it that will be displayed on the plot >>grid - displays the gridlines on the graph Bar graphs are also able to be created Writing to a file - writing a file from the start Appending a file - adding to the end of a preexisting file >>save filename - saves the file Will always overwrite an existing file >>type FileName - displays the data in the file >>load FileName - loads the file and puts the data into a matrix User defined functions that return a single value Function header containts

11 the reserved word function The name of the output argument The name of the function The input arguments in parenthesis A comment the describes what the function does (%) The body of the function End - at the end of the function. This lets matlab know the function is over Function argument = functionname(input arguments) % the function does Statements here End Naming the file and the function the same thing is generally a good idea Function variables will not show up in the workspace like script variables Commands and functions >>type - types out the function for you to see >>load - creates a variable with the same name as the file Lecture Use a logical matrix and the sum function to be able to count how many of a certain letter are in a string && checks first statement then second & check both statements anyways or statement Chapter 4 >>if condition Action end '' double quotes like these are used inside printed statements to tell matlab to print only one apostrophe (') If-else statement if condition Action1 Else Action2 Error('error statement') Displaces the message in red If condition 1 Action 1 Elseif condition 2 Action 2 Elseif condition 3 Action 3 Else Action 4 End

12 The Switch Statement Switch Switch_Expression Case caseexp1 Action1 Case caseexp2 Action2 Case caseexp3 Action3 Otherwise Action4 End 'Switch_Expression' must be either a scalar or a string Combining multiple expressions can be done using { expression1, expression2} These will both result in the same action The "is" function in MatLab Many statements will have the word "is" in front of them and will return a logical answer >>isletter('h') Ans = 1 >>isempty Checks for an empty matrix >>isa(num, 'int16') Used to check a number to verify if it is a particular type >>iskeyword('xxx') Test to see if the word is a key word in matlab and can or can't be used as a variable Chapter 6 While If Or Switch Case For the project Sodoku Three functions One to check the rows One to check the columns One to check the compartments More types of user defined functions Functions that return or store variables Function [variables, calculated] = FunctionName(input) Functions that accomplish a task without returning values Function FunctionName(input) Cannot be inbedded in other statements and the outputs can not be stored as variables Functions that return values versus printing

13 It is good practice to separate the printing task from the function. The printing should be done in the script Passing arguments to functions Functions that don't need arguments like a function that returns a random number can completely leave the parenthesis out if desired If you're going to use input functions no parenthesis are needed either because the arguments will be asked for later in the function Matlab Program organization Modular programs - each program is broken down into their individual functions Main program - the main scrip that calls to the modular programs Primary function - the main function of the document Subfunction - the function that is called by the primary function Menu driven modular program Menu driven - matlab will display a menu of choices for the user to choose from Variable scope Scope - the workspace in which a variable is valid Base workspace - the workspace created in the command window of matlab Local variable - only used for a single function. Exists only inside that function Scripts interact with the variables in the workspace, however functions do not Persistent variables - variable that are not forgotten when the function is over Persistent 'variable' >>clear function Clears all the persistent variables >>clear func2 Clears the specific function's persistent variables Debugging techniques >>checkcode Function used to search for possible problems in the code Types of errors Syntax - an error in using the code Spelling errors Runtime (execution) errors - using incorrect matrix dimensions Logical error - a mistake in reasoning by the programmer >>echo functionname Lets the programmer know what function is being ran each time >>dbstop FunctionName # Stops the debug as the specified line number >>dbcont Continue the debugging >>dbquit Quits the debugging Breakpoint alley Denoted by a grey line in the code, use to set as a stopping point in the code to exam everything that has happened so far Function stubs Writing smaller functions that will eventually be combined to one script Live Scripts, Code Cells, and Publishing code Live scripts

14 Make the coding look nicer things such as: Different fonts Graphs next to code Equations Stored in.mlx files Code cells Allows each section of code to be run one at a time %% title of cell Click on the cell and hit run to run the specific section Chapter 11 Using objects with graphics and plot properties >>figure Returns the graphics handle Handle - basically the information about a graphic >>get(figure) Shows you all the information about the plot >>get(nameoffigure, 'Property') >>set(nameoffigure, 'PropertyName', property value) 'ui' = user interface Color is stored as the matrix [red green blue] [1 1 1] = white [0 0 0] = black 'gca' = get current axes 'gcf' = get current figure Chapter 5 Preface Counted loop - a loop that will repeat for a finite amount of times Conditional loops - repeats the loop for unknown amount of times until a condition is no longer met The for loop Counted loop >>For LoopVariable = range Action(s) End When using a running product, don't forget to initialize the variable as 1 >>subplot(r,c,n) Creates a matrix of plots with r rows c columns and n is the particular plot in the matrix While loops This is the conditional loop used in Matlab

15 >>while condition Action End The loop will eventually need to become false otherwise an infinite loop will be created Ctrl+C will get you out of this Use a variable to count how many times the loop is repeated. Var = var + 1 Put this inside the loop and it will count how many times the loop is done These can commonly be used to check for legal values being inputted to a function Loops with vectors and matrices; vectorizing Typically used with for loops >>for I = 1:length(vec) Action End To use this on a matrix a nested for loop would be best >>for col = 1:c For for = 1:c Do something with mat(row, Column) End End >>any >>all >>find 'is' functions return logicla values >>checkcode Lets you know if there are any style or function problems in the code Timing >>tic - starts a clock >>toc - ends a clock Chapter 12 Plot functions and customizing plots Plot - creates a 2D scatter plot Bar - creates a bar graph Clf - clears the figure window Xlable - sets the x label Ylable - sets the y label Title - sets the title Legend - creates a legend Sprintf - Chapter 7

16 String - any number of characters and is contained in single quotes Creating string variables Substring - a portion of an already created string Control characters - characters that cannot be printed, but accomplish a task (spaces) Leading blanks - a string that starts with a space Trailing blanks - a string that ends with a space Input('enter a string: ', 's') that makes the input a string and can be assigned to a variable from there Operations on strings String concatenation - combines 2 strings >>first = 'bird' >>last = 'house' >> [first last] Birdhouse >>strcat(1,2) horizontally combines two strings This removes all blanks while the bracket method does not >>char Along with converting numbers into characters This function will combine strings vertically and will add necessary spaces to even up the matrix >>blanks(#) Creates a blank string variable >>sprintf Creates a string instead of simply printing out the variables you originally wanted >>deblank Removes trailing blanks from a string >>strtrim Removes bother leading and trailing blanks from a function >>upper(string) Makes a string all uppercase >>lower(string) Makes a string all lowercase >>strcmp(str1, str2) Compares two strings and returns 1 or 0 depending on if the strings are identical or not >>strcmpi(str2, str2) Compares two strings, but ignores case >>strfind(string, substring) Finds places where the substring is in the main string and returns the positions using linear indexing >>strrep(string, substring1, substring2) Replaces substring 1 with substring 2 >>eval(string) Used to evaluate a function if there is a function inside a string 'is' function for strings Returns logical true or false functions >>isletter(string) 1's for letters 0's for anything else Isnumber

17 Isspace isempty >>ischar Test to see if it s a character Converting between string and number types Num2str Int2str Str2double Str2num Chapter 8 Cell arrays Elements of cell arrays can be of any type Use {} to denote a cell array The type of a cell array is always 'cell' Cell(r, c) Creates an empty cell array with r rows and c columns Cellvariable(cell number) Will tell you the type of the cell being referenced Cellvariable{cell number} Displays what is in the cell Strjoin Joins multiple strings together Strsplit Splits a string into its original elements Structures Structure name = struct(information and assignments) The class is stored as a struct Using the dot operator (.) allows you to navigate the structure Using an fprintf will only be able to display individual components. Not the whole structure Rmfield Removes a field from a structure Isstruct Checks if a variable is a structure Fieldnames Returns the names of all the fields in the structure This is returned as a cell array Enhanced data structures Categorial arrays Allows one to store a finite, countable number of different possible values Categories Returns the categories in alphabetical order Countcats or summary Counts how many time each category occurs They work in slightly different ways. Summary displays the names by the number of occurrences

18 Ordinal categorical arrays This can be used when there is a more logical order than simply alphabetical Variable = categorical(list, the, different, categories, in order, of, appearance, here) Tables Variable = table(c1, C2, 'RowNames' R1) Use {} to extract data from string assignments and get the numerical matrix Summary Will show you information about the categories Sorting Sort(data array) Fliplr or flipup can be used to change from ascending order to descending order Sortrows Will sort the function by row Index Vector End Cell2struct Changes a cell to a structure Struct2cell Changes a structure to a cell

Intro Chapter 1 Demo Help Lookfor Doc Quit exit Variable variablename = expression = assignment operator, initializing Incrementing Identifier names

Intro Chapter 1 Demo Help Lookfor Doc Quit exit Variable variablename = expression = assignment operator, initializing Incrementing Identifier names Intro Ways to execute a code -GUI or IDE (command line) Ssh - secure shell (gets machine into the main shell) 259 Avery office () means its a function Mod (clock arithmetic) No semicolon gives you an answer

More information

SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014

SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 Instructor: Nurul Farahain Mohammad 1 It s all about MATLAB What is MATLAB? MATLAB is a mathematical and graphical software package

More information

Vectors and Matrices. Chapter 2. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Vectors and Matrices. Chapter 2. Linguaggio Programmazione Matlab-Simulink (2017/2018) Vectors and Matrices Chapter 2 Linguaggio Programmazione Matlab-Simulink (2017/2018) Matrices A matrix is used to store a set of values of the same type; every value is stored in an element MATLAB stands

More information

Introduction to MATLAB

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

String Manipulation. Chapter 7. Attaway MATLAB 4E

String Manipulation. Chapter 7. Attaway MATLAB 4E String Manipulation Chapter 7 Attaway MATLAB 4E Strings: Terminology A string in MATLAB consists of any number of characters and is contained in single quotes strings are vectors in which every element

More information

Lecture 15 MATLAB II: Conditional Statements and Arrays

Lecture 15 MATLAB II: Conditional Statements and Arrays Lecture 15 MATLAB II: Conditional Statements and Arrays 1 Conditional Statements 2 The boolean operators in MATLAB are: > greater than < less than >= greater than or equals

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

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

PART 1 PROGRAMMING WITH MATHLAB

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

Finding, Starting and Using Matlab

Finding, 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 information

Chapter 2. MATLAB Fundamentals

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

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

MATLAB PROGRAMMING LECTURES. By Sarah Hussein

MATLAB PROGRAMMING LECTURES. By Sarah Hussein MATLAB PROGRAMMING LECTURES By Sarah Hussein Lecture 1: Introduction to MATLAB 1.1Introduction MATLAB is a mathematical and graphical software package with numerical, graphical, and programming capabilities.

More information

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

PowerPoints 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 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

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

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group Introduction to MATLAB Simon O Keefe Non-Standard Computation Group sok@cs.york.ac.uk Content n An introduction to MATLAB n The MATLAB interfaces n Variables, vectors and matrices n Using operators n Using

More information

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

Step by step set of instructions to accomplish a task or solve a problem Step by step set of instructions to accomplish a task or solve a problem Algorithm to sum a list of numbers: Start a Sum at 0 For each number in the list: Add the current sum to the next number Make the

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

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

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

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

Data Structures: Cell Arrays and Structures. Chapter 8. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Data Structures: Cell Arrays and Structures. Chapter 8. Linguaggio Programmazione Matlab-Simulink (2017/2018) Data Structures: Cell Arrays and Structures Chapter 8 Linguaggio Programmazione Matlab-Simulink (2017/2018) Cell Arrays A cell array is a type of data structure that can store different types of values

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

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

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student

More information

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT PROGRAMMING WITH MATLAB DR. AHMET AKBULUT OVERVIEW WEEK 1 What is MATLAB? A powerful software tool: Scientific and engineering computations Signal processing Data analysis and visualization Physical system

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

Today s topics. Announcements/Reminders: Characters and strings Review of topics for Test 1

Today s topics. Announcements/Reminders: Characters and strings Review of topics for Test 1 Today s topics Characters and strings Review of topics for Test 1 Announcements/Reminders: Assignment 1b due tonight 11:59pm Test 1 in class on Thursday Characters & strings We have used strings already:

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

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

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

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

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB: Contents VARIABLES... 1 Storing Numerical Data... 2 Limits on Numerical Data... 6 Storing Character Strings... 8 Logical Variables... 9 MATLAB S BUILT-IN VARIABLES AND FUNCTIONS... 9 GETTING HELP IN MATLAB...

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

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how

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

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

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

Part #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr A0B17MTB Matlab Part #1 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague You will learn Scalars, vectors, matrices (class

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

Introduction to MATLAB for Engineers, Third Edition

Introduction to MATLAB for Engineers, Third Edition PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is

More information

Repetition Structures Chapter 9

Repetition Structures Chapter 9 Sum of the terms Repetition Structures Chapter 9 1 Value of the Alternating Harmonic Series 0.9 0.8 0.7 0.6 0.5 10 0 10 1 10 2 10 3 Number of terms Objectives After studying this chapter you should be

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

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

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

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA Starting with a great calculator... Topic 5: Introduction to Programming in Matlab CSSE, UWA! MATLAB is a high level language that allows you to perform calculations on numbers, or arrays of numbers, in

More information

Chapter 3: Introduction to MATLAB Programming (4 th ed.)

Chapter 3: Introduction to MATLAB Programming (4 th ed.) Chapter 3: Introduction to MATLAB Programming (4 th ed.) Algorithms MATLAB scripts Input / Output o disp versus fprintf Graphs Read and write variables (.mat files) User-defined Functions o Definition

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

Lecture 2: Variables, Vectors and Matrices in MATLAB

Lecture 2: Variables, Vectors and Matrices in MATLAB Lecture 2: Variables, Vectors and Matrices in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1 and Chapter 2. Variables

More information

Matlab Introduction. Scalar Variables and Arithmetic Operators

Matlab 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 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

Loop Statements and Vectorizing Code

Loop Statements and Vectorizing Code CHAPTER 5 Loop Statements and Vectorizing Code KEY TERMS looping statements counted loops conditional loops action vectorized code iterate loop or iterator variable echo printing running sum running product

More information

Introduction to Engineering gii

Introduction to Engineering gii 25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.

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

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

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

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

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

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

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

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

Starting 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 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

Teaching Manual Math 2131

Teaching Manual Math 2131 Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................

More information

QUICK INTRODUCTION TO MATLAB PART I

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

AN INTRODUCTION TO MATLAB

AN INTRODUCTION TO MATLAB AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,

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

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

ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah) Introduction ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah) MATLAB is a powerful mathematical language that is used in most engineering companies today. Its strength lies

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

MATLAB GUIDE UMD PHYS401 SPRING 2011

MATLAB GUIDE UMD PHYS401 SPRING 2011 MATLAB GUIDE UMD PHYS401 SPRING 2011 Note that it is sometimes useful to add comments to your commands. You can do this with % : >> data=[3 5 9 6] %here is my comment data = 3 5 9 6 At any time you can

More information

Information for Candidates. Test Format

Information for Candidates. Test Format Information for Candidates Test Format The MathWorks Certified MATLAB Professional (MCMP) exam consists of two sections: 25 multiplechoice questions and 8 performance-based problems. MATLAB access is not

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

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

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

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

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

To start using Matlab, you only need be concerned with the command window for now. Getting Started Current folder window Atop the current folder window, you can see the address field which tells you where you are currently located. In programming, think of it as your current directory,

More information

EGR 111 Introduction to MATLAB

EGR 111 Introduction to MATLAB EGR 111 Introduction to MATLAB This lab introduces the MATLAB help facility, shows how MATLAB TM, which stands for MATrix LABoratory, can be used as an advanced calculator. This lab also introduces assignment

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

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

Introduction to MATLAB 7 for Engineers

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

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

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1 MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED Christian Daude 1 Introduction MATLAB is a software package designed to handle a broad range of mathematical needs one may encounter when doing scientific

More information

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

The Warhol Language Reference Manual

The Warhol Language Reference Manual The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

More information

Basics of Java Programming

Basics of Java Programming Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement

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

Introduction to MATLAB Introduction to MATLAB --------------------------------------------------------------------------------- Getting MATLAB to Run Programming The Command Prompt Simple Expressions Variables Referencing Matrix

More information

2.0 MATLAB Fundamentals

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

XQ: An XML Query Language Language Reference Manual

XQ: An XML Query Language Language Reference Manual XQ: An XML Query Language Language Reference Manual Kin Ng kn2006@columbia.edu 1. Introduction XQ is a query language for XML documents. This language enables programmers to express queries in a few simple

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

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

Creating a C++ Program

Creating a C++ Program Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer. 1 Creating a C++ Program created using an

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

LECTURE 1. What Is Matlab? Matlab Windows. Help

LECTURE 1. What Is Matlab? Matlab Windows. Help LECTURE 1 What Is Matlab? Matlab ("MATrix LABoratory") is a software package (and accompanying programming language) that simplifies many operations in numerical methods, matrix manipulation/linear algebra,

More information

Dr. Khaled Al-Qawasmi

Dr. Khaled Al-Qawasmi Al-Isra University Faculty of Information Technology Department of CS Programming Mathematics using MATLAB 605351 Dr. Khaled Al-Qawasmi ١ Dr. Kahled Al-Qawasmi 2010-2011 Chapter 3 Selection Statements

More information

Introduction to MATLAB

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

PROGRAMMING AND ENGINEERING COMPUTING WITH MATLAB Huei-Huang Lee SDC. Better Textbooks. Lower Prices.

PROGRAMMING AND ENGINEERING COMPUTING WITH MATLAB Huei-Huang Lee SDC. Better Textbooks. Lower Prices. PROGRAMMING AND ENGINEERING COMPUTING WITH MATLAB 2018 Huei-Huang Lee SDC P U B L I C AT I O N S Better Textbooks. Lower Prices. www.sdcpublications.com Powered by TCPDF (www.tcpdf.org) Visit the following

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

EE168 Handout #6 Winter Useful MATLAB Tips

EE168 Handout #6 Winter Useful MATLAB Tips Useful MATLAB Tips (1) File etiquette remember to fclose(f) f=fopen( filename ); a = fread( ); or a=fwrite( ); fclose(f); How big is a? size(a) will give rows/columns or all dimensions if a has more than

More information

SMS 3515: Scientific Computing. Sem /2015

SMS 3515: Scientific Computing. Sem /2015 s s SMS 3515: Scientific Computing Department of Computational and Theoretical Sciences, Kulliyyah of Science, International Islamic University Malaysia. Sem 1 2014/2015 The if s that are conceptually

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

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

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

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

Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17. Fundamental Concepts Expressed in JavaScript Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

More information

Introduction to MATLAB LAB 1

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