Scilab Programming. The open source platform for numerical computation. Satish Annigeri Ph.D.
|
|
- Blake Tyler
- 5 years ago
- Views:
Transcription
1 Scilab Programming The open source platform for numerical computation Satish Annigeri Ph.D. Professor, Civil Engineering Department B.V.B. College of Engineering & Technology Hubli Sep, 2010 Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
2 About Scilab Introduction Scilab is an open source numerical computation platform Multiplatform - Windows, Linux, Mac OS X, Solaris, Unixes An interactive numerical tool Matrices are a built-in data type in Scilab All operations on matrices are built-in Has a scripting programming language to write functions and develop libraries Has 2D and 3D graph plotting capabilities Has a large number of libraries contributed by the community Image Processing, Optimization, Genetic Algorithms, Neural Networks LabView Gateway - connects NI LabView with Scilab and access Scilab s power within LabView Xcos - hybrid dynamic systems modeller and simulator Interfaces with code written in Fortran, C, C++ Embeddable - Scilab/Xcos C code generator for FLEX board Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
3 Introduction Current Status of Scilab Current version is beta 3 Scicos is now called Xcos New improved code editor Dockable application windows - Editor, Graphics window New architecture for modular plug-ins - ATOMS Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
4 Scilab Applications Introduction Civil Engineering Matrix structural analysis, Finite element analysis Xcos - Mechanical vibration, Hydraulic circuit analysis Electrical Sciences Xcos - Circuit simulation Filter design Image processing Control systems Hardware interfacing, Sensors, Embedded systems Mechanical Sciences Robotics Finite element analysis Computer Science Graph theory Image processing ANN, GA, Fuzzy logic Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
5 Agenda Introduction Scilab Programming Language Data types, Operators, Expressions, Statements Script files Functions, Input and output arguments, Variable number of arguments File Operations Opening and closing files Reading from files Writing to files Reading Microsoft Excel files Writing CSV text files Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
6 Scilab Resources Introduction Scilab Website Scilab website - Xcos website - Scilab documentation - Extending Scilab - zone/extensions Tools for Scilab development - zone/tools Scilab Tutorials Tutorial on Scilab website - My Lulu webpage has two tutorials Introduction to Scilab - Matrix Structural Analysis of Plane Frames - Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
7 Introduction Preliminaries Scilab can be used in interactive mode like a calculator Scilab can be used in batch mode to execute a set of commands written in a file, called a script file. Scilab can be used to write functions like any other programming language Global local variables Argument passing mechanism Scilab is weakly typed - No stringent restrictions on type declaration, type conversion Scilab is case sensitive Output of a command is immediately echoed on the console Multiple commands on the same line can be separated by a comma (,) or a semicolon (;) A semicolon (;) at the end of a statement suppresses echoing of output from the statement Single line comments begin with // and last up to the end of the line Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
8 Introduction Scilab Environment Scilab command prompt is: --> Access to on-line help Type -->help Press F1 From the menu choose? = Scilab Help On-line help offers two choices Table of contents Search for specific patterns Direct access to help on Scilab functions: -->help pattern Scilab constants π: %pi ɛ: %eps NaN: %nan e: %e i = 1: %i inf: %inf Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
9 Introduction Scilab Variables Variable names follow the same convention as in C Names can contain alphanumeric characters Names must begin with an alphabet An underscore character is treated as an alphabet Variables can be assigned values Name of a variable in an expression evaluates to its value Value may be a real number, imaginary number, matrix, string or any other Scilab data type Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
10 Scilab Workspace Introduction Examine the Scilab workspace List names of contents of workspace: -->who Detailed list of contents of workspace: -->whos List names of constants: -->whos -type constant List names of contents beginning with a : -->whos -name a Objects can be of the following data types Constant String Boolean Function Library Polynomial Rational Cell (ce) List Struct (st) Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
11 Introduction Scilab Workspace Save entire contents of the workspace to a disk file Save selected variables from the workspace to a disk file Clear entire contents of the workspace Clear selected variables from the workspace Load data from a previously save workspace Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
12 Introduction Matrix Operations in Scilab Defining matrices Matrices are enclosed between square brackets Elements are defined row by row. All rows must contain the same number of columns Elements in a row can be separated by a comma or a space Rows are separated by a semi colon or by a carriage return Semi colon at the end of the last row is optional Simple matrix operations on two matrices a and b Addition c = a + b Subtraction c = a - b Multiplication c = a * b Right division c = a / b Same as c = a b 1 or c = a b Left division c = a b Same as c = a 1 b or c = b a Transpose b = a Power b = a 2 or b = a**2 Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
13 Introduction Automating Scilab Initially you may be contented using Scilab as a powerful interactive calculator matrix computations graphics rich set of built-in functions You will soon begin to yearn for more Can I store repeated commands and execute them all at once? Can I modularize repeated tasks and call them when I need? Answer to both the questions is: Yes We will take this up in three steps: We will take a look at the Scilab Programming Language We will learn how to write Scilab functions We will learn how to write Scilab script files Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
14 Scilab Data Types Scilab Programming Language Scilab has a programming language of its own Every command that can be typed at the Scilab command prompt (without generating an error of course!) is a valid statement in Scilab programming language. Your knowledge of using Scilab interactively becomes the starting point for programming Offers features expected from a traditional procedural languages: Data types: Built-in and User-defined Control structures: if then else if, for, do, select Functions: input arguments, output arguments, input and output arguments Does not currently support object oriented programming Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
15 Scilab Data Types Scilab Data Types Let us try our hand with a few Scilab data types Constant -->a = rand(3,3)*10; -->typeof(a) constant Boolean -->b = a < 5; -->typeof(b) boolean Function -->whos -->typeof(whos) function String -->s = Satish ; -->typeof(s) string Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
16 Scilab Data Types Scilab Data Types... Polynomial -->p1 = poly([2 3 5], x ]; # polynomial in x with three roots 2 3 and 5 -->typeof(p1) polynomial Rational -->p2 = poly([1 4], x ); -->p3 = p1 / p2; -->typeof(p3) rational Structure -->x.name = Satish ; -->x.salary = 20e3; -->typeof(x) st Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
17 Scilab Data Types Scilab Data Types... Other data types available in Scilab are: Handle List State-Space Sparse - for sparse matrices Boolan Sparse - for boolean sparse matrices Hypermat - N dimension array with N = 3 Cell - Cell array fptr - Scilab intrinsic (C or Fortran code) Pointer Size Implicit Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
18 Operators Operators [ ] Matrix definition ( ) Extraction, eg. m = a(k) Transpose Subtraction \ Left division Exponent.\ Elementwise left division. Elementwise exponent ; Statement separator ( ) Insertion, eg. a(k) = m + Addition * Multiplication / Right division.* Elementwise multiplication./ Elementwise right division Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
19 Control Structures Control Structures Loop Constructs for - Repeat a block of statements based on an index variable while - Conditional repetition of a block of statements Select Constructs if then, if then else, if then elseif else select - similar to switch in C Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
20 Control Structures for Loop In its simplest form, let us use a for loop to print a sequence of numbers Numbers 1 to 5 -->for i = 1:5 -->disp(i) -->end Odd numbers between 1 and 5 -->for i = 1:2:5, disp(i), end Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
21 Control Structures for Loop Even numbers between 1 and 5 -->for i = 2:2:6, disp(i), end With fractional increment -->for dx = 0:%pi/16:%pi, disp(dx), end In reverse gear, if you so wish -->for dx = 10:-2:5, disp(dx), end Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
22 for Loop Control Structures Every for loop must close with a corresponding end, no matter what the depth of nesting is Another accepted form of the for loop is with the keyword do for variable = expression do statement end If expression is a matrix or a row vector, then variable takes as values the values of each column of the matrix or row vector If expression is a list variable, then variable takes as values the successive entries of the list for loop can be interrupted with the break statement, forcing the end of the innermost for loop One cycle of for loop can be skipped with the continue keyword Other means of interfering with the for loop are: pause, return and abort Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
23 Control Structures if then, if then else General format of if in different combinations is Only one test -->a = -2; -->if a < 0 then --> disp( Negative ) -->end Negative One test with an alternative a = 2 -->if a < 0 then --> disp( Negative ) -->else -->disp( Non-negative ) -->end Non-negative Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
24 Control Structures if then elseif else Multiple test with an alternative a = -2 -->if a < 0 then --> disp( Negative ) Negative -->elseif a == 0 then -->disp( Zero ) else -->disp( Positive ) -->end Notice that the word Negative is displayed even before you complete the if block. This is because of short-circuiting of boolean expression evaluation. If this alternative is true, then others need not be evaluated. Try this loop with different values of a Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
25 select is useful when the number of tests in a if block is large. But can handle only equal to comparisons and not inequalities. It is similar to the switch block in C. -->ch = input( Enter an integer: ); 3 -->select ch -->case 1 then -->disp( One ) -->case 2 then -->disp( Two ) -->case 3 then -->disp( Three ) Three -->else -->disp( Dah! ) -->end Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38 select Control Structures
26 Control Structures Script Files Script files are text files containing Scilab statements There is no separate workspace for the script file The statements take their input from the Scilab workspace Output generated by the statements are stored in the Scilab workspace Useful for testing and debugging statements Useful to write the main program (similar to the main() function in C programming language) Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
27 Scilab Functions Scilab Functions Functions help modularize code They define a well defined interface to the function and serve as a means of communication between the designer of the function and the consumer of the function Function interface consists of Name of the function - usually indicates the purpose of the function. Purpose is further explained in the documentation Input arguments - variables sent into the function from the calling module. Appear on the RHS of assignment statements. Output arguments - variables whose values are calculated inside the function and sent out to the calling module. Appear on the LHS of assignment statements. Calling a function invokes the function. Variables in the function call are called input and output parameters. Number and type of arguments (as in the function definition) and parameters (as in the function call) must match. Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
28 Scilab Functions Scilab Function Skeleton function [out1, out2,...] = function-name(in1, in2,...) statement-1; statement-2;... statement-n; endfunction Function definition begins with the keyword function A function can have one or more output arguments Function name must be chosen to reflect its purpose Function name can consist of alphanumeric characters First character must be an alphabet Underscore is treated as an alphabet A function can have zero or more input arguments Function definition ends with the keyword endfunction A comment is begun by a pair of forward slashes (//) and lasts until the end of line Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
29 Scilab Functions Function to Calculate Length of a Line Consider two points on a plane P 1 (x 1, y 1 ) and P 2 (x 2, y 2 ) The length between the two points is L = (x 2 x 1 ) 2 + (y 2 y 1 ) 2 Let us write a simple function to obtain the length and make a few improvements to increase its usefulness. Scilab has a built-in code editor named SciPad Syntax color highlighting Edit and save code All features of a code editor - search, search and replace, save as etc. Compile source code and load into Scilab workspace function [L] = Len(x1, y1, x2, y2) // Returns length of line between (x1,y1) and (x2,y2) dx = x2 - x1; dy = y2 - y1; L = sqrt(dx 2 + dy 2); endfunction Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
30 Scilab Functions Use the Scilab Function Save the function into a file in a known folder. Note down the folder location and filename for later use. In SciPad, click on Execute Load into Scilab Switch to Scilab and confirm the function is loaded into the workspace -->whos -type function Name Type Size Bytes... Len function 664 Call the function with known input and test the output -->Len(0, 0, 4, 3) ans = 5. Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
31 Test the Function Scilab Functions Give input in different ways and test -->x1=0; y1=0; x2=4; y2=3; -->Len(x1, y1, x2, y2) ans = 5. Identify its shortcomings Does not adapt itself to points in 3D space P 1 (x 1, y 1, z 1 ) and P 2 (x 2, y 2, z 2 ). L = (x 2 x 1 ) 2 + (y 2 y 1 ) 2 + (z 2 z 1 ) 2 Improve the function Instead of giving coordinates (x 1, y 1, z 1 ) and (x 2, y 2, z 2 ) as input, give vectors with coordinates p1 and p2 as input. Point p1 can be (x 1, y 1 ) or (x 1, y 1, z 1 ) depending on whether you want it to be a point in a plane or in space. Make the function work for points in a plane as well as in space Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
32 Scilab Functions Test Improved Function function [L] = Len(p1, p2) dx = p2 - p1; // works for points in 2D as well as 3D L = sqrt(sum(dx. 2)) endfunction This time around, input consists of two points, each point having two coordinates arrnged as two elements in a vector -->Len([0, 0], [4, 3]) ans = 5. Try a point in space -->Len([0, 0, 0], [4, 3, 0]) ans = 5. Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
33 Scilab Functions Function with Two Output Parameters function [L, dx] = Len(p1, p2) dx = p2 - p1; L = sqrt(sum(dx. 2)) endfunction You can use this function in different ways. If you only want the length and not the projections along the axes -->L = Len([0 0 0], [4 3 0]) L = 5. When you want to use both output parameters -->[L dxdydz] = Len([0 0 0], [4 3 0]) dxdydz = L = 5. Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
34 Scilab Functions Some Tips and Tricks Choose names of functions with care Not too cryptic Not too long Meaningful, reflecting the function s purpose Choose the input and output arguments after due process of thought If some input arguments must be of a specified size, do check before using them If necessary, check the number of input and output parameters at run time. There is no guarantee that the number of parameters are the same as the number of arguments It is allowed to have a variable both as an input and as an output argument. Typically, such a variable brings in a value in it, gets modified within the function and the changed value is sent back Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
35 Scilab Functions Further Improved Scilab Function function [L dx] = Len(p1, p2) [lhs, rhs] = argn() if rhs < 2 then disp( Too few arguments. L = 0; dx = []; return end dx = p2 - p1 L = sqrt(sum(dx. 2)) endfunction Returning from function ) Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
36 Scilab Functions Short Inline Functions Short functions can be defined inline deff( [L]=Len(p1, p2), L=sqrt(sum((p2 - p1) 2)) ) Function deff(string1, string2) takes two strings as input parameters First string is the interface to the function, consisting of output arguments, function name and input arguments Second string consists of statements making up the body of the function If body contains more than one statement, they must be defined as elements of a vector deff( [L]=Len(p1, p2), [ dx=p2 - p1 ; L=sqrt(sum((dx) 2)) ]) Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
37 Scilab Functions Some Closing Thoughts on Functions Functions can be called in other functions, and you can build a hierarchy of functions Simple functions are independent of other user defined functions and do a simple task efficiently Complex functions depend on other user defined functions You can build a library of such functions for a well defined task image processing genetic algorithms structural optimization These become toolboxes when packaged in a specified way and bundled along with documentation Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
38 Scilab Functions Thank You Satish Annigeri Ph.D. (BVBCET, Hubli) Scilab Programming 27 Sep, / 38
Scilab File Operations
Scilab File Operations Scilab - The open source platform for numerical computation Satish Annigeri Ph.D. Professor, Civil Engineering Department B.V.B. College of Engineering & Technology Hubli 580 031
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More 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 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 informationMcTutorial: 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 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. 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 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 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 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 informationAn Introduction to Scilab
An Introduction to Scilab Satish Annigeri Ph.D. Professor of Civil Engineering B.V. Bhoomaraddi College of Engineering & Technology, Hubli satish@bvb.edu December 2009 Table of Contents Preface... ii Introduction...
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationIntroduction to. 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 informationMATLAB BASICS. M Files. Objectives
Objectives MATLAB BASICS 1. What is MATLAB and why has it been selected to be the tool of choice for DIP? 2. What programming environment does MATLAB offer? 3. What are M-files? 4. What is the difference
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 MATLAB
Introduction to MATLAB Chen Huang Computer Science and Engineering SUNY at Buffalo What is MATLAB? MATLAB (stands for matrix laboratory ) It is a language and an environment for technical computing Designed
More informationLaboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++
Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It
More informationScilab4.1.2 PartI:Introduction
Scilab 4.1.2 Part I: Introduction p. 1 Scilab4.1.2 PartI:Introduction Gianluca Antonelli Stefano Chiaverini Università degli Studi di Cassino {antonelli,chiaverini}@unicas.it http://webuser.unicas.it/antonelli
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 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 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 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 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 informationMATLAB. Devon Cormack and James Staley
MATLAB Devon Cormack and James Staley MATrix LABoratory Originally developed in 1970s as a FORTRAN wrapper, later rewritten in C Designed for the purpose of high-level numerical computation, visualization,
More informationMatlab (Matrix laboratory) is an interactive software system for numerical computations and graphics.
Matlab (Matrix laboratory) is an interactive software system for numerical computations and graphics. Starting MATLAB - On a PC, double click the MATLAB icon - On a LINUX/UNIX machine, enter the command:
More informationDigital Image Analysis and Processing CPE
Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors
More 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 information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good start. If you are
More informationMATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning.
Introduction MATLAB = MATrix LABoratory Interactive system. Basic data element is an array that does not require dimensioning. Efficient computation of matrix and vector formulations (in terms of writing
More informationMatlab Tutorial for COMP24111 (includes exercise 1)
Matlab Tutorial for COMP24111 (includes exercise 1) 1 Exercises to be completed by end of lab There are a total of 11 exercises through this tutorial. By the end of the lab, you should have completed the
More informationIntroduction to Matlab
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. 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 informationAn 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 informationIntroduction to Scientific Computing Tool Scilab
Introduction to Scientific Computing Tool Scilab Chao Chieh Lan and Jian Hao Liou Department of Mechanical Engineering National Cheng Kung University 2009/09/22 1 Computing Tools for Mechanism Analyses
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 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 informationVariables 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 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 informationTUTORIAL MATLAB OPTIMIZATION TOOLBOX
TUTORIAL MATLAB OPTIMIZATION TOOLBOX INTRODUCTION MATLAB is a technical computing environment for high performance numeric computation and visualization. MATLAB integrates numerical analysis, matrix computation,
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 informationIntroduction to MATLAB
Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following
More informationCITS2401 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 informationMATLAB 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 informationA brief introduction to SCILAB
A brief introduction to SCILAB SCILAB is a powerful and versatile package for mathematical modelling and an excellent tool for solving a wide range of engineering problems. SCILAB supports simple interactive
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 informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More 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 informationLab 0a: Introduction to MATLAB
http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 1 of 1 Lab 0a: Introduction to MATLAB Professor Deepa Kundur Introduction and Background Welcome to your first real-time
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 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 Scicoslab
Introduction to Scicoslab Introduction Scicoslab is an open source alternative for modeling and simulation of dynamical system Latest version 4.4 can be downloaded from http://www.scicoslab.org/ getting
More informationStarting 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 informationHow to Use MATLAB. What is MATLAB. Getting Started. Online Help. General Purpose Commands
How to Use MATLAB What is MATLAB MATLAB is an interactive package for numerical analysis, matrix computation, control system design and linear system analysis and design. On the server bass, MATLAB version
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 Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationMATLAB GUIDE UMD PHYS401 SPRING 2012
MATLAB GUIDE UMD PHYS40 SPRING 202 We will be using Matlab (or, equivalently, the free clone GNU/Octave) this semester to perform calculations involving matrices and vectors. This guide gives a brief introduction
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 General Information Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good
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 informationOur Strategy for Learning Fortran 90
Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data
More informationECE Lesson Plan - Class 1 Fall, 2001
ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not
More 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 informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
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 informationComputer Vision. Matlab
Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent
More informationIntroduzione a MatLab. Prof. Sebastiano Battiato
Introduzione a MatLab Prof. Sebastiano Battiato MatLab Environment MATLAB Matlab = Matrix Laboratory Originally a user interface for numerical linear algebra routines (Lapak/Linpak) Commercialized 1984
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationEGR 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 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 informationA QUICK INTRODUCTION TO MATLAB
A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Basic operations and a few illustrations This set is independent from rest of the class notes. Matlab will be covered in recitations and occasionally
More 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 informationCM0340 Tutorial 2: More MATLAB
CM0340 Tutorial 2: More MATLAB Last tutorial focussed on MATLAB Matrices (Arrays) and vectors which are fundamental to how MATLAB operates in its key application areas including Multimedia data processing
More informationA QUICK INTRODUCTION TO MATLAB. Intro to matlab getting started
A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Intro to matlab getting started Basic operations and a few illustrations This set is indepent from rest of the class notes. Matlab will be covered
More 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 for Econ 511b
Introduction to Matlab for Econ 511b I. Introduction Jinhui Bai January 20, 2004 Matlab means Matrix Laboratory. From the name you can see that it is a matrix programming language. Matlab includes both
More informationYOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 1 INTRODUCING SOME MATHEMATICS SOFTWARE (Matlab, Maple and Mathematica) This topic provides
More informationCHAD Language Reference Manual
CHAD Language Reference Manual INTRODUCTION The CHAD programming language is a limited purpose programming language designed to allow teachers and students to quickly code algorithms involving arrays,
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
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 informationDigital Image Processing
Digital Image Processing Introduction to MATLAB Hanan Hardan 1 Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The name MATLAB is an interactive system
More informationCourse Layout. Go to https://www.license.boun.edu.tr, follow instr. Accessible within campus (only for the first download)
Course Layout Lectures 1: Variables, Scripts and Operations 2: Visualization and Programming 3: Solving Equations, Fitting 4: Images, Animations, Advanced Methods 5: Optional: Symbolic Math, Simulink Course
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 informationSECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB
SECTION 2: PROGRAMMING WITH MATLAB MAE 4020/5020 Numerical Methods with MATLAB 2 Functions and M Files M Files 3 Script file so called due to.m filename extension Contains a series of MATLAB commands The
More informationCS 221 Lecture. Tuesday, 13 September 2011
CS 221 Lecture Tuesday, 13 September 2011 Today s Agenda 1. Announcements 2. Boolean Expressions and logic 3. MATLAB Fundamentals 1. Announcements First in-class quiz: Tuesday 4 October Lab quiz: Thursday
More informationIntroduction to Matlab
Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More 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 informationFiles and File Management Scripts Logical Operations Conditional Statements
Files and File Management Scripts Logical Operations Conditional Statements Files and File Management Matlab provides a group of commands to manage user files pwd: Print working directory displays the
More 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 informationEL2310 Scientific Programming
(pronobis@kth.se) Overview Overview Wrap Up More on Scripts and Functions Basic Programming Lecture 2 Lecture 3 Lecture 4 Wrap Up Last time Loading data from file: load( filename ) Graphical input and
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 informationCS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010
CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please
More informationEP375 Computational Physics
EP375 Computational Physics Topic 1 MATLAB TUTORIAL BASICS Department of Engineering Physics University of Gaziantep Feb 2014 Sayfa 1 Basic Commands help command get help for a command clear all clears
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
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 informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationIntroduction to MATLAB
Introduction to MATLAB Zhiyu Zhao (sylvia@cs.uno.edu) The LONI Institute & Department of Computer Science College of Sciences University of New Orleans 03/02/2009 Outline What is MATLAB Getting Started
More informationMATLAB: The Basics. Dmitry Adamskiy 9 November 2011
MATLAB: The Basics Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 9 November 2011 1 Starting Up MATLAB Windows users: Start up MATLAB by double clicking on the MATLAB icon. Unix/Linux users: Start up by typing
More information! The MATLAB language
E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical
More informationIntroduction to Matlab
Introduction to Matlab Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More informationEvolutionary Algorithms. Workgroup 1
The workgroup sessions Evolutionary Algorithms Workgroup Workgroup 1 General The workgroups are given by: Hao Wang - h.wang@liacs.leideuniv.nl - Room 152 Furong Ye - f.ye@liacs.leidenuniv.nl Follow the
More informationECE 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