Computational Modelling 102 (Scientific Programming) Tutorials
|
|
- Magdalene Rodgers
- 6 years ago
- Views:
Transcription
1 COMO 102 : Scientific Programming, Tutorials Computational Modelling 102 (Scientific Programming) Tutorials Dr J. D. Enlow Last modified August 18, 2003.
2 Contents Tutorial 1 : Introduction 3 Tutorial 2 : Matrices 6 Tutorial 3 : Plotting 7 Tutorial 4 : M-files 8 Tutorial 5 : More M-files 9 Tutorial 6 : Vectors 10 Tutorial 7 : Three Planets 11 Tutorial 8 : X-windows 12 Tutorial 9 : Loops 14 Tutorial 10 : Arrays 15 Tutorial 11 : Comotank 16 2
3 COMO 102: Tutorial 1, Tutorial 1 : Introduction What is MATLAB? MATLAB is a high performance interactive program to help you with numeric computation and data visualisation. MATLAB is built upon a foundation of sophisticated matrix software for analyzing linear systems of equations. These tools allow you to solve problems in applied mathematics, physics, chemistry, engineering, finance, etc. - almost any application area that deals with numerical calculations. The MATLAB Window First go the View menu, select Desktop Layout, then Five Panel. You should see the following windows: Launch Pad Command History Workspace Current Directory Command Window The Launch Pad The Launch Pad provides easy access to documentation, demos and tools. The first entry represents default MATLAB functionality. Below this you will see entries like Image Processing Toolbox, which are extra packages that you can use. The Command History This keeps a record of each command you evaluate in the command window. Unlike Mathematica, modification of long series of commands in MATLAB is difficult unless M-files are used (script files). You will most often use the command window only to invoke your M-files. You can drag items out of the Command History into the Command Window, which saves typing them in again.
4 COMO 102: Tutorial 1, Workspace All data within MATLAB is stored in variables. MATLAB stores all variables as matrices. For example, a single number is stored as a 1 1 matrix. The MATLAB workspace contains all of the variables used during the current MATLAB session. The Workspace Browser gives you information about the variables and the functions in use, and allows you to double click on matrices to edit them in the Array Editor. Current Directory When using M-files you will want to set the current directory to your work directory. This sets where MATLAB looks for M-files, and also where it saves output by default. The Current Directory window shows the files within the current directory. The Command Window The command window is where you enter your commands. To access previous commands you can use the Command History window, or use the up and down arrow keys to scroll through previous commands. You can not directly edit previous commands within the command window! Matrices in MATLAB Matrices in MATLAB are entered in square brackets. Elements in a row are separated by spaces or commas, and the rows are separated by semi-colons (;). 1. Enter the following matrix in the command window at the input (>>) prompt: a=[1 2 3 ; ]. 2. Check that the size of a, as reported in the Workspace window, is 2x3. 3. How much memory does the matrix a use? 4. Enter the 3x3 matrix b: b=[ ; ; ]. 5. We multiply matrices in MATLAB with *. Try a*b. Is the answer correct? 6. Evaluate b*a. Can you explain MATLAB s output in this case? More matrices Enter the following matrices in MATLAB: A 1 = A 2 = A 3 = A 4 = [ ]
5 COMO 102: Tutorial 1, Some Matrix Operations MATLAB uses * for matrix multiplication. We can add and subtract matrices with the + and - symbols. We can transpose a matrix by using the symbol (on the same key as "). Questions Use MATLAB to answer the following: 1. Calculate the transpose of each matrix given in Section More Matrices. 2. Calculate A 1 A Calculate A T 3 A T Calculate A 1 + A T 1. Scalars in MATLAB MATLAB handles scalars in the conventional way. Try the following: sqrt(2) 3. 2^3^2 (note: is this 2^(3^2) or (2^3)^2?) 4. 2 * [ ; ] Unusual Operations MATLAB also allows a significant number of unusual matrix operations, i.e. operations on matrices generally not used in mathematics. We will investigate some of these in the first exercise. Help Spend some time browsing MATLAB s help. simple function? Can you figure out how to plot a
6 COMO 102: Tutorial 2, Tutorial 2 : Matrices 1. Calculate by hand the matrix product A v where A = a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33, v = x y z 2. Write the following equations in the form A v = b. x + 7y + z = 3 4x + 5y + 8z = 1 x + 8y + 10z = 5 3. The 3 by 3 identity matrix is defined as I Note that I B = B I = B for any square 1 matrix B. Verify by hand that I v = v. 4. Given a square matrix A, the inverse of A, written A 1, has the property that. A A 1 = A 1 A = I. The inverse does not always exist; examples of non-invertible matrices are: Use MATLAB to check that the inverse does exist for the matrix A of question 2. Also attempt to invert one of the non-invertible matrices and observe the error message produced by MATLAB. 5. Use the following result to solve the system given in question 2 for x: A v = b A 1 A v = A 1 b I v = A 1 b v = A 1 b 1 A square matrix is a matrix that has the same number of rows as columns.
7 COMO 102: Tutorial 3, Tutorial 3 : Plotting 1. Plot the following functions in MATLAB over the domain x [ 10, 10]. (a) sin(x) with 100 sample points. (b) tan(x) with 100 sample points. (c) tan(x) with sample points, and also change the y-axis to show only y [ 10, 10]. Explain the behaviour you observe before and after modifying the y-axis. (d) sin(x) and cos(x), where sin(x) is drawn with an red line and cos(x) with green. 2. Plot sin(x), sin(2x), sin(3x) and sin(4x) all in one graph over the domain x [0, 2π]. Label the axes appropriately, insert a plot legend, and use distinctive colours and/or dashing for the different lines. Also enter a title for the plot. 3. Read the help on subplot: SUBPLOT Create axes in tiled positions. H = SUBPLOT(m,n,p), or SUBPLOT(mnp), breaks the Figure window into an m-by-n matrix of small axes, selects the p-th axes for for the current plot, and returns the axis handle. The axes are counted along the top row of the Figure window, then the second row, etc. For example, SUBPLOT(2,1,1), PLOT(income) SUBPLOT(2,1,2), PLOT(outgo) plots income on the top half of the window and outgo on the bottom half. SUBPLOT(m,n,p), if the axis already exists, makes it current. Use subplot to show the graphs of sin(x), sin(2x), sin(3x) and sin(4x) in a 2x2 rectangular arrangement. For each of the four sub-graphs set the y-axis to show the range [ 1.5, 1.5], and also insert an appropriate plot title.
8 COMO 102: Tutorial 4, Tutorial 4 : M-files 1. (a) Write a function called myroots (in the mfile myroots.m ). For a quadratic of the form ax 2 + bx + c, your function should input the coefficients in a 1x3 matrix (i.e. [a, b, c]), and output the two roots in a 1x2 matrix. Your m-file should work whether the roots are real and distinct, real and repeated, or complex conjugates. (b) Test your function with the quadratic y = x 2 2x 2. (c) Test your function with a quadratic with a repeated real root. (d) Test your function with a quadratic with complex roots.
9 COMO 102: Tutorial 5, Tutorial 5 : More M-files 1. Write a function m-file named quadraticplot which does ALL of the following: (a) Accepts a vector coeff containing the coefficients a, b, c of the quadratic y = ax 2 + bx + c as its input. (b) Determines the roots x 1 and x 2 of the quadratic (where x 1 x 2 ). (c) Exits if the roots are complex, with the message Complex Roots!. (d) Plots the quadratic over the region [x 1, x2 + ], = 1 + (x 2 x 1 ) 5. (e) Draws blue circles at the roots. 2. Test your function on the following quadratics: (a) y = x 2 1 (b) y = (x + 3)(x 5) (c) y = x (d) y = (x 10)(x 9)
10 COMO 102: Tutorial 6, Tutorial 6 : Vectors Consider a function which takes a vector v = (v 1, v 2,..., v n ) as input, and returns three scalars: The sum of the squares of the elements (i.e. v v v2 n ). The sum of the cubes of the elements (i.e. v v v 3 n). The mean of the elements (i.e. Write this function in two ways: v 1 + v v n ). n 1. Using a single for loop. 2. Without loops of any kind.
11 COMO 102: Tutorial 7, Tutorial 7 : Three Planets 1. Copy the threeplanets.m file to your home directory. 2. Edit the code so that the initial speed is passed as an input parameter to the threeplanets function. 3. Use your previous answer to produce plots of the asteroids trajectory for the initial speeds of: 3 km s 1, 4 km s 1, 5 km s 1. 6 km s 1.
12 COMO 102: Tutorial 8, Tutorial 8 : X-windows In the start menu you should find X-Win Pro under Programs, which contains Xserver and Xstartup. Run Xstartup. You will be presented with the following dialog, although the default values may be different: Do the following: In Start Method select REXEC. In Host Name/ IP Address type in como.otago.ac.nz. In User ID enter your usercode as on your ID card (e.g. johsa118). In Password enter you ID number (e.g ). Click on the down arrow beside the text box for Command File, and select X11R6 from the drop down list.
13 COMO 102: Tutorial 8, Then click Execute. After clicking Execute you should see a window that looks something like this: This is an xterm (x-windows terminal), and is run by the remote server (como.otago.ac.nz). Commands that you enter in this window are handled by the server, not by the computer you are sitting at! The server is a much faster computer with plenty of memory and hard drive space. Some basic commands available to you are: ls mkdir mydirectory cd mydirectory rmdir mydirectory directory listing (shows the files in the current directory) makes a directory called mydirectory. changes the current directory to mydirectory. removes the directory called mydirectory. Special directories (folders) include:. The current directory.. The parent directory of the current directory ~ Your home directory For example, cd ~ will change the current directory to your home directory. As a general rule try to use lowercase letters without spaces or punctuation for directory names. Next do the following through X-windows: 1. Change to your home directory. 2. Create a directory called week8. 3. Make week8 the current directory. 4. Type pwd to see that the present working directory is /home/yourusercode/week8. Now you are ready to begin Exercise 8.
14 COMO 102: Tutorial 9, Background: Tutorial 9 : Loops If statements can take the following form: if ( d > 0 ) { printf("d>0!"); } else if ( d < 0 ) { printf("d<0!"); } else { printf("d==0!"); } For loops are of the following form: for( starting_condition ; test ; expression ) statement; The starting condition is executed first, then for each iteration of the loop statement is evaluated, followed by expression. The loop stops when test becomes false. For example, to print the numbers from 1 through to 10: int i; for ( i=1 ; i<=10 ; i++ ) printf("%d ",i); While loops are a little simpler: int i=1; while (i<=10) { printf("%d ",i); i++; /* add one to i */ } Tutorial Questions: 1. Write a program that outputs n! for each n from n = 1 to n = Write a function called sqroot which calculates the square root of x using the iterative method of Q1) of Exercise 5. Iterate until the approximation r satisfies r r x (note that the absolute value of a floating point number is calculated using the fabs function in C - read the man page on fabs for more info by typing man fabs on the command line). 3. Test your answer to question 2 by calculating the square root of 10 with sqroot.
15 COMO 102: Tutorial 10, Tutorial 10 : Arrays 1. Write a function with declaration void farray( double x[], double y[], double numvals ); where x represents the vector x, y represents the vector y and numvals is the number of elements in x (and in y). Your function should set the vectors x and y as follows: x is a set of evenly spaced points in the interval [0, 2π]. Each element of y is calculated from the corresponding element of x as follows: y i = max( sin(x i ), cos(x i ) ), where max(a, b) is equal to a if a > b and b otherwise. 2. Write a function with declaration void outputpoints( double x[], double y[], double numvals ); which outputs the points in x and y to the file xyvals.txt, using the same output file format as shown in lecture Write a main routine which uses your functions to create the xyvals.txt file with 100 output points. 4. Plot a graph of the data in xyvals.txt in MATLAB (see lecture 10).
16 COMO 102: Tutorial 11, Tutorial 11 : Comotank 1. Log in to COMO using XWinPro (or CYGWIN). 2. Make a week11 directory in your home directory on COMO and change into that directory. 3. Enter the following command: [j@como week11]$ tar zxvf /usr/local/comotank.tgz You should see a list of files being extracted to a directory comotank. 4. Change into the new comotank directory with cd comotank 5. Type ls to get a directory listing. You should see: [j@como comotank]$ ls bigmatch comotank tanks tankview 6. Type cd tanks to change into the tanks directory. 7. Type nedit sucky.c & to confirm that the source code for the sucky tank is available. 8. Compile the sucky tank (gcc -o sucky -Wall sucky.c generic.c). 9. Change back into the comotank directory with cd Start a match with four tanks using the following command:./comotank sucky bouncer findshoot tatie 11. Review the match with tankview. If the graphics are a little slow you might wish to try tankview stored.game fast, or even tankview stored.game fast fast. 12. Repeat the last two steps, this time with more tanks in the match.
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 informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationIntroduction to MatLab. Introduction to MatLab K. Craig 1
Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationIntroduction to Matlab
Introduction to Matlab Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 9 January 08 Introduction MATLAB is a programming language that grew out of the need to process matrices. It is used extensively
More informationIntroduction 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 informationUniversity of Alberta
A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.
More informationMatlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:
1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a
More informationComputer Project: Getting Started with MATLAB
Computer Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands. Examples here can be useful for reference later. MATLAB functions: [ ] : ; + - *
More informationMatlab Programming Introduction 1 2
Matlab Programming Introduction 1 2 Mili I. Shah August 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 Starting Matlab
More informationStarting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to.
Starting Matlab Go to MATLAB Laboratory 09/09/10 Lecture Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu http://ctx.loyola.edu and login with your Loyola name and password...
More informationIntroduction to Matlab
Introduction to Matlab Kristian Sandberg Department of Applied Mathematics University of Colorado Goal The goal with this worksheet is to give a brief introduction to the mathematical software Matlab.
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,
More informationHERIOT-WATT UNIVERSITY DEPARTMENT OF COMPUTING AND ELECTRICAL ENGINEERING. B35SD2 Matlab tutorial 1 MATLAB BASICS
HERIOT-WATT UNIVERSITY DEPARTMENT OF COMPUTING AND ELECTRICAL ENGINEERING Objectives: B35SD2 Matlab tutorial 1 MATLAB BASICS Matlab is a very powerful, high level language, It is also very easy to use.
More informationIntroduction 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 informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationELEC4042 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 information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationMATLAB TUTORIAL WORKSHEET
MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent
More informationLab. Manual. Practical Special Topics (Matlab Programming) (EngE416) Prepared By Dr. Emad Saeid
KINGDOM OF SAUDI ARABIA JAZAN UNIVERSTY College of Engineering Electrical Engineering Department المملكة العربية السعودية وزارة التعليم العالي جامعة جازان كلية الھندسة قسم الھندسة الكھربائية Lab. Manual
More informationDesktop 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 informationTop bar items. Current folder should be shown. Command Window This has the the prompt >>
MA1710: Week 2 for, if, else, break Getting started in session 2 With the Windows 7 operating system that we have in our Labs start Matlab as you did last week by clicking the mouse pointer on Start (bottom
More informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationIntroduction 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 informationAppendix A. Introduction to MATLAB. A.1 What Is MATLAB?
Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system
More informationDr 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 informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More informationIntroduction 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 informationLab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013
Lab of COMP 406 MATLAB: Quick Start Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 1: 11th Sep, 2013 1 Where is Matlab? Find the Matlab under the folder 1.
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationMATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline
MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots
More informationGetting started with MATLAB
Sapienza University of Rome Department of economics and law Advanced Monetary Theory and Policy EPOS 2013/14 Getting started with MATLAB Giovanni Di Bartolomeo giovanni.dibartolomeo@uniroma1.it Outline
More informationLAB 1 General MATLAB Information 1
LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by
More informationIntroduction to Unix and Matlab
Introduction to Unix and Matlab 1 Introduction to the Unix System 1.1 Login Pick any machine in Room 451; the screen is probably dark. If so, press the [return] key once or twice. You should see something
More informationMATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY
MATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY What is MATLAB? MATLAB (MATrix LABoratory) developed by The Mathworks, Inc. (http://www.mathworks.com) Key Features: High-level language for numerical
More informationIntroduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College
Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationMATLAB SUMMARY FOR MATH2070/2970
MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should
More informationOUTLINES. 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 informationAN 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 informationEE 216 Experiment 1. MATLAB Structure and Use
EE216:Exp1-1 EE 216 Experiment 1 MATLAB Structure and Use This first laboratory experiment is an introduction to the use of MATLAB. The basic computer-user interfaces, data entry techniques, operations,
More informationA/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System
CHAPTER 1 INTRODUCTION Digital signal processing (DSP) technology has expanded at a rapid rate to include such diverse applications as CDs, DVDs, MP3 players, ipods, digital cameras, digital light processing
More informationGetting To Know Matlab
Getting To Know Matlab The following worksheets will introduce Matlab to the new user. Please, be sure you really know each step of the lab you performed, even if you are asking a friend who has a better
More informationThe value of f(t) at t = 0 is the first element of the vector and is obtained by
MATLAB Tutorial This tutorial will give an overview of MATLAB commands and functions that you will need in ECE 366. 1. Getting Started: Your first job is to make a directory to save your work in. Unix
More informationMatlab Tutorial and Exercises for COMP61021
Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a
More informationCreates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.
EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems
More informationMatlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin
Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming using familiar mathematical notation The name Matlab stands
More informationWhat is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment
What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful
More informationIntroduction to Matlab
Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,
More informationGetting Started with MATLAB
Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as
More informationFinite Math - J-term Homework. Section Inverse of a Square Matrix
Section.5-77, 78, 79, 80 Finite Math - J-term 017 Lecture Notes - 1/19/017 Homework Section.6-9, 1, 1, 15, 17, 18, 1, 6, 9, 3, 37, 39, 1,, 5, 6, 55 Section 5.1-9, 11, 1, 13, 1, 17, 9, 30 Section.5 - Inverse
More informationMath 2250 MATLAB TUTORIAL Fall 2005
Math 2250 MATLAB TUTORIAL Fall 2005 Math Computer Lab The Mathematics Computer Lab is located in the T. Benny Rushing Mathematics Center (located underneath the plaza connecting JWB and LCB) room 155C.
More informationTo see what directory your work is stored in, and the directory in which Matlab will look for files, type
Matlab Tutorial For Machine Dynamics, here s what you ll need to do: 1. Solve n equations in n unknowns (as in analytical velocity and acceleration calculations) - in Matlab, this is done using matrix
More informationStarting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.
What is MATLAB? MATLAB (short for MATrix LABoratory) is a language for technical computing, developed by The Mathworks, Inc. (A matrix is a rectangular array or table of usually numerical values.) MATLAB
More informationChapter 1 Introduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,
More informationTo 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 informationIntroduction to MATLAB
CHEE MATLAB Tutorial Introduction to MATLAB Introduction In this tutorial, you will learn how to enter matrices and perform some matrix operations using MATLAB. MATLAB is an interactive program for numerical
More informationAn Introduction to MATLAB II
Lab of COMP 319 An Introduction to MATLAB II Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 2: 16th Sep, 2013 1 Outline of Lab 2 Review of Lab 1 Matrix in Matlab
More informationx = 12 x = 12 1x = 16
2.2 - The Inverse of a Matrix We've seen how to add matrices, multiply them by scalars, subtract them, and multiply one matrix by another. The question naturally arises: Can we divide one matrix by another?
More informationAMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA
AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical
More informationMatlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More informationMATLAB 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 informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More informationPROGRAMMING 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 informationIntroduction and MATLAB Basics
Introduction and MATLAB Basics Lecture Computer Room MATLAB MATLAB: Matrix Laboratory, designed for matrix manipulation Pro: Con: Syntax similar to C/C++/Java Automated memory management Dynamic data types
More informationGetting Started with MATLAB
Getting Started with MATLAB Math 4600 Lab: Gregory Handy http://www.math.utah.edu/ borisyuk/4600/ Logging in for the first time: This is what you do to start working on the computer. If your machine seems
More informationSTAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial
STAT/MATH 395 A - PROBABILITY II UW Winter Quarter 2016 Néhémy Lim Matlab Tutorial 1 Introduction Matlab (standing for matrix laboratory) is a high-level programming language and interactive environment
More informationMATLAB QUICK START TUTORIAL
MATLAB QUICK START TUTORIAL This tutorial is a brief introduction to MATLAB which is considered one of the most powerful languages of technical computing. In the following sections, the basic knowledge
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationSECTION 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 informationFreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx
1 of 9 FreeMat Tutorial FreeMat is a general purpose matrix calculator. It allows you to enter matrices and then perform operations on them in the same way you would write the operations on paper. This
More informationMATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras
MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras Module No. #01 Lecture No. #1.1 Introduction to MATLAB programming
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationMATLAB 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 informationMatlab and Octave: Quick Introduction and Examples 1 Basics
Matlab and Octave: Quick Introduction and Examples 1 Basics 1.1 Syntax and m-files There is a shell where commands can be written in. All commands must either be built-in commands, functions, names of
More informationECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu
ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu 0. What is MATLAB? 1 MATLAB stands for matrix laboratory and is one of the most popular software for numerical computation. MATLAB s basic
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationINC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1
INC151 Electrical Engineering Software Practice MATLAB Graphics Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 Graphical display is one of MATLAB s greatest strengths and most
More informationGeneral Information. There are certain MATLAB features you should be aware of before you begin working with MATLAB.
Introduction to MATLAB 1 General Information Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting a
More informationObject Oriented Programming Using C++ Mathematics & Computing IET, Katunayake
Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout
More informationIntroduction to MATLAB
Introduction to MATLAB Contents 1.1 Objectives... 1 1.2 Lab Requirement... 1 1.3 Background of MATLAB... 1 1.4 The MATLAB System... 1 1.5 Start of MATLAB... 3 1.6 Working Modes of MATLAB... 4 1.7 Basic
More informationGetting started with MATLAB
Getting started with MATLAB You can work through this tutorial in the computer classes over the first 2 weeks, or in your own time. The Farber and Goldfarb computer classrooms have working Matlab, but
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationIntroduction to Matlab
What is Matlab? Introduction to Matlab Matlab is software written by a company called The Mathworks (mathworks.com), and was first created in 1984 to be a nice front end to the numerical routines created
More informationIntroduction to Scientific Computing with Matlab
UNIVERSITY OF WATERLOO Introduction to Scientific Computing with Matlab SAW Training Course R. William Lewis Computing Consultant Client Services Information Systems & Technology 2007 Table of Contents
More informationOutline. CSE 1570 Interacting with MATLAB. Outline. Starting MATLAB. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 10 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationChapter 2. MATLAB Fundamentals
Chapter 2. MATLAB Fundamentals Choi Hae Jin Chapter Objectives q Learning how real and complex numbers are assigned to variables. q Learning how vectors and matrices are assigned values using simple assignment,
More informationLab 1 Intro to MATLAB and FreeMat
Lab 1 Intro to MATLAB and FreeMat Objectives concepts 1. Variables, vectors, and arrays 2. Plotting data 3. Script files skills 1. Use MATLAB to solve homework problems 2. Plot lab data and mathematical
More informationIntroduction to Octave/Matlab. Deployment of Telecommunication Infrastructures
Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,
More informationIntroduction: The Unix shell and C programming
Introduction: The Unix shell and C programming 1DT048: Programming for Beginners Uppsala University June 11, 2014 You ll be working with the assignments in the Unix labs. If you are new to Unix or working
More informationShort Version of Matlab Manual
Short Version of Matlab Manual This is an extract from the manual which was used in MA10126 in first year. Its purpose is to refamiliarise you with the matlab programming concepts. 1 Starting MATLAB 1.1.1.
More informationMATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.
MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab
More information