2.2 Creating & Initializing Variables in MATLAB
|
|
- Sherman Long
- 5 years ago
- Views:
Transcription
1 2.2 Creating & Initializing Variables in MATLAB Slide 5 of 27 Do-It-Yourself (DIY) EXERCISE 2-1 Answer the followings: (a) What is the difference between an array, a matrix, and a vector? (b) Let: c = (b-1) What is the size of c? (b-2) What is the value of c(2,3)? (b-3) List the subscripts of all elements containing the value 0.6. (a) In MATLAB, an array is a collection of data values organized into rows (m) & columns (n) with a given single name. The array is the fundamental unit of data in any MATLAB program. A MATLAB array can be categorized into vector (1-D array) or matrix (2-D array). (b) exercise_2_1b.m exercise_2_1b.m >> exercise_2_1b c = c = [ ; ; ] b_1 = 3 4 b_1 = size(c) b_2 = c(2,3) b_2 = c_1_1 = c(1,1) c_1_1 = c_1_2 = c(1,2) c_1_2 = c_1_3 = c(1,3) c_1_3 = c_1_4 = c(1,4) c_1_4 = c_2_1 = c(2,1) c_2_1 = c_2_2 = c(2,2) c_2_2 = c_2_3 = c(2,3) c_2_3 = c_2_4 = c(2,4) c_2_4 = ) c_3_1 = c(3,1) c_3_1 = c_3_2 = c(3,2) c_3_2 = c_3_3 = c(3,3) c_3_3 = c_3_4 = c(3,4) c_3_4 = 0 c(1,4), c(2,1), and c(3,2) are the elements containing the value of 0.6
2 2.2 Creating & Initializing Variables in MATLAB Slide 6 of 27 Do-It-Yourself (DIY) EXERCISE 2-2 Determine the size of the following arrays, using MATLAB. Check your answers by entering the arrays into MATLAB and using whos command (or checking the Workspace Browser). Note that the later arrays may depend on the definitions of arrays defined earlier in this exercise. (a) u = [10 20*i 10+20]; (b) v = [-1; 20; 3]; (c) w = [1 0-9; 2-2 0; 1 2 3]; (d) x = [u v]; (e) y(3,3) = -7; (f) z = [zeros(4,1) ones(4,1) zeros(1,4) ]; (g) v(4) = x(2,1); exercise_2_2_var.m
3 2.2 Creating & Initializing Variables in MATLAB Slide 7 of 27 Do-It-Yourself (DIY) EXERCISE 2-2 (continued) exercise_2_2_var.m u = [10 20*i 10+20]; v = [-1; 20; 3]; w = [1 0-9; 2-2 0; 1 2 3]; x = [u v]; y(3,3) = -7; z = [zeros(4,1) ones(4,1) zeros(1,4) ]; v(4) = x(2,1); Create a MATLAB script (M-File: exercise_2_2_var.m) and execute a series of commands above. Answer the following questions: (a) What is the value of w(2,1)? (b) What is the value of x(2,1)? (c) What is the value of y(2,1)? (d) What is the value of v(3)? exercise_2_2_var.m exercise_2_2_var.m >> exercise_2_2_var u = [10 20*i 10+20]; w_2_1 = 2 v = [-1; 20; 3]; w = [1 0-9; 2-2 0; 1 2 3]; x_2_1 = 0 20i x = [u v]; y(3,3) = -7; y_2_1 = 0 z = [zeros(4,1) ones(4,1) zeros(1,4) ]; v_3 = 3 v(4) = x(2,1); w_2_1 = w(2,1) x_2_1 = x(2,1) y_2_1 = y(2,1) v_3 = v(3)
4 Slide 10 of Special Values Do-It-Yourself (DIY) EXERCISE 2-3 Determine the contents of the following subarrays: 1. Let: c = (a) c(2,:) (b) c(:,end) (c) c(1:2,2:end) (d) c(6) (e) c(4:end) (f) c(1:2,2:4) (g) c([1 3],2) (h) c([2 2],[3 3]) exercise_2_3_1.m >> exercise_2_3_1 exercise_2_3_1.m c_a = c = [ ; ; c_b = ]; c_a = c(2,:) c_c = c_b = c(:,end) c_c = c(1:2,2:end) c_d = c_e = c_d = c(6) c_e = c(4:end) c_f = c_f = c(1:2,2:4) c_g = c_g = c([1 3],2) c_h = c([2 2],[3 3]) c_h = (d): c(6) = c(3,2) WHY??? Since MATLAB (in fact) stores data in column major order, one can (actually) treat a multidimensional array as though it were a 1-D array whose length is equal to the number of elements in the multidimensional array... (NOTE) under normal circumstance, you should never use this feature of MATLAB!
5 Slide 11 of Special Values Do-It-Yourself (DIY) EXERCISE 2-3 (continued) 2. Determine the contents of array a after the following statements are executed : (a) a = [1 2 3; ; 7 8 9]; a([3 1],:) = a([1 3],:); (b) a = [1 2 3; ; 7 8 9]; a([1 3],:) = a([2 2],:); (c) a = [1 2 3; ; 7 8 9]; a = a([2 2],:); 3. Determine the contents of array a after the following statements are executed : (a) (b) (c) b = [1 2 3]; a(2,:) = b; b = []; a(:,3) = b ; b = [7 8 9]; a(3,:) = b([3 1 2]); exercise_2_3_2.m / exercise_2_3_3.m exercise_2_3_2.m >> exercise_2_3_2 a_a = a = [1 2 3; ; 7 8 9]; a([3 1],:) = a([1 3],:); a_a = a a_b = a = [1 2 3; ; 7 8 9]; a([1 3],:) = a([2 2],:); a_b = a a_c = a = [1 2 3; ; 7 8 9]; a_c = a([2 2],:) exercise_2_3_3.m >> exercise_2_3_3 a_a = b = [1 2 3]; a(2,:) = b; a_a = a a_b = b = []; a(:,3) = b'; a_c = a_b = a b = [7 8 9]; a(3,:) = b([3 1 2]); a_c = a
6 Slide 14 of Data Files Do-It-Yourself (DIY) EXERCISE 2-4 Answer the followings: 1. How would you tell MATLAB to display all real values in exponential format with 15 significant digits? 2. What do the following sets of statements do? What is the output from them? (a) (b) radius = input( Enter circle radius:\n ); area = pi * radius^2; str = [ The area is num2str(area)]; disp(str); value = int2str(pi); disp([ The value is value! ]); 3. What do the following sets of statements do? What is the output from them? value = e2; fprintf( value = e\n,value); fprintf( value = f\n,value); fprintf( value = g\n,value); fprintf( value = 12.4f\n,value); 1. format long e will display all real values in exponential format with 15 significant digits. 2. exercise_2_4_2.m exercise_2_4_2.m >> exercise_2_4_2 (a) radius = input('enter circle radius:\n'); Enter circle radius: area = pi*radius^2; 25 str = ['The area is ' num2str(area)]; The area is disp(str); disp(' '); Hit Enter to continue... disp('hit Enter to continue...'); disp(' '); The value is 3! pause (b) value = int2str(pi); disp(['the value is ' value '!']); 3. exercise_2_4_3.m exercise_2_4_3.m >> exercise_2_4_3 value = e2; value = e+04 fprintf('value = e\n',value); value = fprintf('value = f\n',value); value = fprintf('value = g\n',value); value = fprintf('value = 12.4f\n',value);
7 Slide 19 of Hierarchy of Operations Do-It-Yourself (DIY) EXERCISE 2-5 Assume that the following variables are defined as: 2 1 a b 3 1 Evaluate the following MATLAB assignment statements, showing the details of hierarchy of operations. (a) result = a.* c; (b) result = a * [c c]; (c) result = a.* [c c]; (d) result = a + b * c; (e) result = a + b.* c; 1 c 2 d 3 exercise_2_5.m exercise_2_5.m >> exercise_2_5 a = [2 1; -1 2]; result_b = b = [0-1; 3 1]; 4 4 c = [1 2]'; 3 3 d = -3; result_c = result_a = a.* c <= CANNOT DO THIS! result_b = a * [c c] result_c = a.* [c c] result_d = a + b * c <= CANNOT DO THIS! result_e = a + b.* c <= CANNOT DO THIS!
8 Slide 20 of Hierarchy of Operations Do-It-Yourself (DIY) EXERCISE 2-6 Solve for x in the equation Ax = B, where: A B Understand that you are solving a set of simultaneous linear equations: a x a x a x b a x a x a x b a x a x a x b a11 a12 a13 b1 x1 Ax B A a21 a22 a 23 B b x x 2 2 a 31 a32 a33 b 3 x 3 This can be solved by a multiplication of Matrix Inverse of A and B, as: 1 x A B In MATLAB, the Matrix Left Division will do the job... A \ B <= which is defined as: inv(a) * B exercise_2_6.m exercise_2_6.m >> exercise_2_6 Simultaneous Linear Equations Solver x = A = [1 2 1; 2 3 2; ]; B = [1 1 0]'; x = A \ B; x x1 = x2 = x = inv(a)*b x3 = x x1 = x(1) x2 = x(2) x3 = x(3)
9 Slide 23 of Introduction to Plotting Do-It-Yourself (DIY) EXERCISE 2-7 Starting from the Example 1-1 (plot of sin(x) function), modify this plot as shown below: Modify: line color/style and marker style Add: title, axis labels, and grid exercise_2_7_sin_x.m exercise_2_7_sin_x.m Based on: example_1_1_sin_x.m clc close all clear all x = 0:0.1:6; y = sin(x); plot(x,y,'k-',x,y,'bo'); title('plot of f(x)=sin(x)'); xlabel('x'); ylabel('sin(x)'); grid on axis equal
10 Slide 24 of Introduction to Plotting Do-It-Yourself (DIY) EXERCISE 2-8 Starting from the Example 1-2 (plot of sin(x) and cos(x) function), modify this plot as shown below: Modify: line color/style Add: title, axis labels, legend, and grid exercise_2_8_cos_x.m exercise_2_8_cos_x.m Based on: example_1_2_cos_x.m clc clear all close all x = 0:0.1:6; y1 = sin(x); y2 = cos(x); plot(x,y1,'b-',x,y2,'r--'); title('plot of sin(x) and cos(x)'); xlabel('x'); ylabel('f(x)'); legend ('f(x)=sin(x)','f(x)=cos(x)') grid on axis equal
Chapter 2 MATLAB Basics
EGR115 Introduction to Computing for Engineers MATLAB Basics from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics 2.1 Variables & Arrays 2.2 Creating & Initializing
More informationChapter 8 Complex Numbers & 3-D Plots
EGR115 Introduction to Computing for Engineers Complex Numbers & 3-D Plots from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: Complex Numbers & 3-D
More informationChapter 1 Introduction to MATLAB
EGR115 Introduction to Computing for Engineers Introduction to MATLAB from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: Computing for Engineers 1.1
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 informationLecture 2 Introduction to MATLAB. Dr.Tony Cahill
Lecture 2 Introduction to MATLAB Dr.Tony Cahill The MATLAB Environment The Desktop Environment Command Window (Interactive commands) Command History Window Edit/Debug Window Workspace Browser Figure Windows
More informationOverview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab
Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D
More informationChapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1
Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values
More information2. MATLAB Basics Cengage Learning. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
MATLAB Programming for Engineers 5th Edition Chapman Solutions Manual Full Download: http://testbanklive.com/download/matlab-programming-for-engineers-5th-edition-chapman-solutions-manual/ 2. MATLAB Basics
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More 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 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 informationObjectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014
PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in
More 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 informationChapter 4 Branching Statements & Program Design
EGR115 Introduction to Computing for Engineers Branching Statements & Program Design from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: Program Design
More informationObjectives. 1 Basic Calculations. 2 Matrix Algebra. Physical Sciences 12a Lab 0 Spring 2016
Physical Sciences 12a Lab 0 Spring 2016 Objectives This lab is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started in this class. It is meant to
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 informationTelemark University College Department of Electrical Engineering, Information Technology and Cybernetics. MathScript
Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Solutions So You Think You Can HANS-PETTER HALVORSEN, 2011.09.07 MathScript Part I: Introduction
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 informationIntroduction to MATLAB
Quick Start Tutorial Introduction to MATLAB Hans-Petter Halvorsen, M.Sc. What is MATLAB? MATLAB is a tool for technical computing, computation and visualization in an integrated environment. MATLAB is
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 Introduction to Programming GENG 200
Introduction To MATLAB Introduction to Programming GENG 200, Prepared by Ali Abu Odeh 1 Table of Contents M Files 2 4 2 Execution Control 3 Vectors User Defined Functions Expected Chapter Duration: 6 classes.
More 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 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 informationmathcad_homework_in_matlab.m Dr. Dave S#
Table of Contents Basic calculations - solution to quadratic equation: a*x^ + b*x + c = 0... 1 Plotting a function with automated ranges and number of points... Plotting a function using a vector of values,
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 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 informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More 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 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 information11/30/15 11:09 AM C:\websi...\mathcad_homework_in_Matlab.m 1 of 6
11/30/15 11:09 AM C:\websi...\mathcad_homework_in_Matlab.m 1 of 6 %% mathcad_homework_in_matlab.m Dr. Dave S# %% Basic calculations - solution to quadratic equation: a*x^2 + b*x + c = 0 clc % clear the
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 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 informationMATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University
MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &
More informationMATLAB 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 informationBIOE 198MI Biomedical Data Analysis. Spring Semester 2019 Lab 1b. Matrices, arrays, m-files, I/O, custom functions
BIOE 198MI Biomedical Data Analysis. Spring Semester 2019 Lab 1b. Matrices, arrays, m-files, I/O, custom functions A. Scalars, vectors, and matrices versus arrays and the associated syntax In terms of
More informationAMS 27L LAB #2 Winter 2009
AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles
More 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 information1. Register an account on: using your Oxford address
1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation
More informationComputational Foundations of Cognitive Science. Inverse. Inverse. Inverse Determinant
Computational Foundations of Cognitive Science Lecture 14: s and in Matlab; Plotting and Graphics Frank Keller School of Informatics University of Edinburgh keller@inf.ed.ac.uk February 23, 21 1 2 3 Reading:
More informationINTRODUCTION TO NUMERICAL ANALYSIS
INTRODUCTION TO NUMERICAL ANALYSIS Cho, Hyoung Kyu Department of Nuclear Engineering Seoul National University 0. MATLAB USAGE 1. Background MATLAB MATrix LABoratory Mathematical computations, modeling
More informationA General Introduction to Matlab
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationWhat is Matlab? The command line Variables Operators Functions
What is Matlab? The command line Variables Operators Functions Vectors Matrices Control Structures Programming in Matlab Graphics and Plotting A numerical computing environment Simple and effective programming
More informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationIntroduction to 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 informationMATLAB. 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 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 informationINTRODUCTION TO MATLAB PLOTTING WITH MATLAB
1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)
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 information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationIntroduction to MATLAB for Numerical Analysis and Mathematical Modeling. Selis Önel, PhD
Introduction to MATLAB for Numerical Analysis and Mathematical Modeling Selis Önel, PhD Advantages over other programs Contains large number of functions that access numerical libraries (LINPACK, EISPACK)
More informationDr 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 informationIntroduction 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 informationMATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations
MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding
More 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 informationPage 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01
Page 1 of E Spring Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Practice Midterm 1 minutes pts Question Points Grade 1 4 3 6 4 16 6 1 Total Notes (a) Write your name and your SID on the top right
More informationIntroduction to MATLAB
GENG 200 Introduction to Programming Faculty of Engineering, ERU Table of Contents 1. Getting Started with MATLAB... 3 1.1 Introduction... 3 1.2 Graphical User Interface... 3 1.3 Help Menu... 4 1.4 Basic
More informationFall 2014 MAT 375 Numerical Methods. Introduction to Programming using MATLAB
Fall 2014 MAT 375 Numerical Methods Introduction to Programming using MATLAB Some useful links 1 The MOST useful link: www.google.com 2 MathWorks Webcite: www.mathworks.com/help/matlab/ 3 Wikibooks on
More informationENGR 1181 MATLAB 05: Input and Output
ENGR 1181 MATLAB 05: Input and Output Learning Objectives 1. Create a basic program that can be used over and over or given to another person to use 2. Demonstrate proper use of the input command, which
More informationIntroduction to Excel Workshop
Introduction to Excel Workshop Empirical Reasoning Center June 6, 2016 1 Important Terminology 1. Rows are identified by numbers. 2. Columns are identified by letters. 3. Cells are identified by the row-column
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 informationLab #1 Revision to MATLAB
Lab #1 Revision to MATLAB Objectives In this lab we would have a revision to MATLAB, especially the basic commands you have dealt with in analog control. 1. What Is MATLAB? MATLAB is a high-performance
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 informationselected topic in transportation 2552/2. 1 Prepared by Lect.Weerakaset Suanpaga
203484 selected topic in transportation 2552/2 Introduction ti to MATLAB 1 Prepared by Lect.Weerakaset Suanpaga Outline Introduction and where to get MATLAB Data structure: matrices, vectors and operations
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 informationIntroduction to GNU-Octave
Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016
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 informationSummer 2009 REU: Introduction to Matlab
Summer 2009 REU: Introduction to Matlab Moysey Brio & Paul Dostert June 29, 2009 1 / 19 Using Matlab for the First Time Click on Matlab icon (Windows) or type >> matlab & in the terminal in Linux. Many
More informationIntroduction to Matlab
Introduction to Matlab What is Matlab The software program called Matlab (short for MATrix LABoratory) is arguably the world standard for engineering- mainly because of its ability to do very quick prototyping.
More informationIntroduction to Matlab
Introduction to Matlab The purpose of this intro is to show some of Matlab s basic capabilities. Nir Gavish, 2.07 Contents Getting help Matlab development enviroment Variable definitions Mathematical operations
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 informationExcel Primer CH141 Fall, 2017
Excel Primer CH141 Fall, 2017 To Start Excel : Click on the Excel icon found in the lower menu dock. Once Excel Workbook Gallery opens double click on Excel Workbook. A blank workbook page should appear
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 informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More 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 informationDSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab
Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have
More informationEng Marine Production Management. Introduction to Matlab
Eng. 4061 Marine Production Management Introduction to Matlab What is Matlab? Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is available
More 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 informationINTRODUCTORY NOTES ON MATLAB
INTRODUCTORY NOTES ON MATLAB C Lamas Fernández, S Marelli, B Sudret CHAIR OF RISK, SAFETY AND UNCERTAINTY QUANTIFICATION STEFANO-FRANSCINI-PLATZ 5 CH-8093 ZÜRICH Risk, Safety & Uncertainty Quantification
More informationWhat is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations
What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations
More informationLab of COMP 406 Introduction of Matlab (II) Graphics and Visualization
Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization Teaching Assistant: Pei-Yuan Zhou Contact: cspyzhou@comp.polyu.edu.hk Lab 2: 19 Sep., 2014 1 Review Find the Matlab under the folder
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 informationFall 2015 Math 337. Basic MatLab
Fall 215 Math 337 Basic MatLab MatLab is a powerful software created by MathWorks, which is used extensively in mathematics, engineering, and the sciences. It has powerful numerical and graphic capabilities,
More informationA Tutorial on Matlab Ch. 3 Programming in Matlab
Department of Electrical Engineering University of Arkansas A Tutorial on Matlab Ch. 3 Programming in Matlab Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Plotting M-file Scripts Functions Control Flows Exercises
More informationThe Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Chapter 7 Graphics Learning outcomes Label your plots Create different
More informationLecture 1: Hello, MATLAB!
Lecture 1: Hello, MATLAB! Math 98, Spring 2018 Math 98, Spring 2018 Lecture 1: Hello, MATLAB! 1 / 21 Syllabus Instructor: Eric Hallman Class Website: https://math.berkeley.edu/~ehallman/98-fa18/ Login:!cmfmath98
More informationME 1020 Engineering Programming with MATLAB. Chapter 1 In-Class Assignment: 1.1, 1.3, 1.13, Topics Covered:
ME 1020 Engineering Programming with MATLAB Chapter 1 In-Class Assignment: 1.1, 1.3, 1.13, 1.16 Topics Covered: Use MATLAB as a calculator Save files to folders and open files from folders Create row vector
More informationMATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab
MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the
More informationEE 1105 Pre-lab 3 MATLAB - the ins and outs
EE 1105 Pre-lab 3 MATLAB - the ins and outs INTRODUCTION MATLAB is a software tool used by engineers for wide variety of day to day tasks. MATLAB is available for UTEP s students via My Desktop. To access
More informationQuestion 2. fprintf('\nenter elements of Matrix 1\n'); for i=1:m, for j=1:n; A(i,j)=input('Value='); end end
Question 1 To find the sum of first N numbers that are divisible by 5 and not divisible by 5. The user has to accept the value of N from the input device. % Description : Script to find sum of elements
More informationLecture 1: Introduction to Scilab
Lecture 1: Introduction to Scilab Ahmed Kebaier kebaier@math.univ-paris13.fr HEC, Paris Outline 1 First Steps with Scilab 2 Outline 1 First Steps with Scilab 2 After launching Scilab, you can test the
More informationIntroduction to Matlab
Technische Universität München WT 21/11 Institut für Informatik Prof Dr H-J Bungartz Dipl-Tech Math S Schraufstetter Benjamin Peherstorfer, MSc October 22nd, 21 Introduction to Matlab Engineering Informatics
More informationMATLAB 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 informationComputer Packet 1 Row Operations + Freemat
Computer Packet 1 Row Operations + Freemat For this packet, you will use a website to do row operations, and then learn to use a general purpose matrix calculator called FreeMat. To reach the row operations
More informationCDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation
CDA5530: Performance Models of Computers and Networks Chapter 8: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationBEGINNING MATLAB. R.K. Beatson Mathematics Department University of Canterbury. 2 Matlab as a simple matrix calculator 2
BEGINNING MATLAB R.K. Beatson Mathematics Department University of Canterbury Contents 1 Getting started 1 2 Matlab as a simple matrix calculator 2 3 Repeated commands 4 4 Subscripting, rows, columns and
More informationENGR 1181 Autumn 2015 Final Exam Study Guide and Practice Problems
ENGR 1181 Autumn 2015 Final Exam Study Guide and Practice Problems Disclaimer Problems seen in this study guide may resemble problems relating mainly to the pertinent homework assignments. Reading this
More informationMatlab Programming Arrays and Scripts 1 2
Matlab Programming Arrays and Scripts 1 2 Mili I. Shah September 10, 2009 1 Matlab, An Introduction with Applications, 2 nd ed. by Amos Gilat 2 Matlab Guide, 2 nd ed. by D. J. Higham and N. J. Higham Matrix
More information