Basic MATLAB

Total Page:16

File Type:pdf, Size:1020Kb

Basic MATLAB Basic MATLAB Scientific Computing, Bridging course Scientific Computing and Matlab n Matlab is a tool and programming environment used in computational science but also in other areas. n A simple environment to quickly test ideas and to study the results n Also available in other tools, such as Freemat, Maple, Mathematica, Comsol Multiphysics, and other programming languages like C/C++, Fortran, Java. Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 1 What is MATLAB? n Developed by MathWorks, Inc. http://www.mathworks.com n First version already in late 70s n Originally MATrix LABoratory. n Matemathical environment for ® Numerical computations ® Graphics ® Programming n Many powerful predefined functions with the ability to define your own. n Own object oriented programming language. Informationsteknologi Collaboration with C++, Java and Fortran possible. Institutionen för informationsteknologi | www.it.uu.se What is MATLAB? n Over 25 plug-in (toolboxes) are available for special applications, eg: ® Signal analysis ® Image analysis ® Statistics ® Symbolic mathematics ® Finacial mathematics ® Parallel computing ® … n Run under UNIX/Linux, Windows or Macintosh. Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 2 Application areas Wherever there are computational problems n Education: mathematics (specifically linear algebra), computational science, physics, chemistry, engineering, economics, etc. n Research: lab environment to test the solution methods, study, analyze problems, perform calculations and visualize the results. n Industry:used in the same manner as in research, for example on development Informationsteknologi departments in biotechnology, electronics, automotive, etc. Institutionen för informationsteknologi | www.it.uu.se MATLAB environment n The development environment (MATLAB desktop) has a plurality of windows, Command window, Current folder, Workspace and Command History. Task: Start Matlab on your computer and change to a Informationsteknologi prefered folder by clicking it in Current folder window. Institutionen för informationsteknologi | www.it.uu.se 3 MATLAB environment n MATLAB is usually controlled from the command window (Command Window), but also from the menus. n Commands are given by »-prompter and executed when return key is pressed. n Example: >> 42 + 19 ans = 61 Informationsteknologi >> exit n Exit matlab: Institutionen för informationsteknologi | www.it.uu.se MATLAB environment n In the command window, >> a = 75 you can work interactively as an advanced calculator. a = 75 The semicolon suppresses printing. >> b = 34; >> c = a*b If no variable names specified, the variable is c = ans (= answer) 2550 >> a+b Task: Compute the sum and Informationsteknologi product of a,b,c and store the ans = results in new variables. Note 109 the use of semicolon. Institutionen för informationsteknologi | www.it.uu.se 4 MATLAB environment n Help is available through the Help menu n But even writing demo in the command window provides information on how to use Matlab. Informationsteknologi Task: How do you perform square root in Matlab? Institutionen för informationsteknologi | www.it.uu.se MATLAB environment Help for individual commands can be done directly in the command window >> help command Ex) What does the command exit ? >> help exit EXIT Exit from MATLAB. EXIT terminates MATLAB. Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 5 Variables in MATLAB A variable in MATLAB n can be viewed as containers of a value of a certain type (integer, float, char, ...) n always have a name. Must begin with a letter. Do not use å, ä, ö, space, hyphen (minus), plus signs etc in the name n can be assigned a value n created when needed, >> a = 3 without special "declaration” a = (is of type "matrix"). 3 n Can be predefined, >> pi Informationsteknologi e.g. pi,eps,realmax ans = 3.1416 Institutionen för informationsteknologi | www.it.uu.se Variables in MATLAB n The variables are displayed in Workspace- window n The issued commands are displayed in Command History Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 6 Variables in MATLAB n Can also list the variables in the , command window using who whos >> who Your variables are: a ans >> whos Name Size Bytes Class a 1x1 8 double array ans 1x1 8 double array Grand total is 2 elements using 16 bytes Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se Variables in MATLAB n Variables can be displayed in various formats >> y = sin(2*pi/3); >> format short e; y >> y y = y = 8.6603e-001 0.8660 >> format short; y >> format long; y y = y = 0.8660 0.86602540378444 % Standardformat >> format long e; y e-001 equals to 10-1 y = 8.660254037844387e- Informationsteknologi 001 Task: Display pi in different formats (note the accuracy is not changed only the format). Institutionen för informationsteknologi | www.it.uu.se 7 Variables in MATLAB n Variables can be saved to file and loaded up on another MATLAB session later. n In the menu use the buttons Save Load n Variables will be saved as so-called MAT-files, files with the extension.mat n MAT-files are called binary and is not readable or editable. Informationsteknologi n Can also use save and load command directly in the command window Institutionen för informationsteknologi | www.it.uu.se Save and load variables n The button Import Data can be used to load other formats such as spreadsheets (Excel), audio files, video files, etc. n Select a file format in the window that opens after clicking the button Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 8 Functions There are lots of predefined functions, such as for n Elementary mathematics n Linear algebra n Graphics in 2D and 3D n Integrals and differential equations n Statistics n Curve fitting Example: abs(x),sqrt(x),sin(x),log(x),log10(x),… (Help -> Documentation -> Matlab -> Mathematics) Informationsteknologi There are lot of Toolboxes with specilized functions. You can also create your own functions. Institutionen för informationsteknologi | www.it.uu.se Matrices n Matrix is the basic data type. n A two-dimensional matrix is a table with rows and columns. n A matrix with m rows and n columns, has the size mxn (m times n). n Vectors are special cases of the matrices, then the number of rows or number of columns is 1. Example: row vector, 1xn, and column vector, mx1. n A matrix of size 1x1 called scalar. n Each value in the matrix are called elements. Informationsteknologi Institutionen för informationsteknologi | www.it.uu.se 9 Vectors Column vector and row vector in MATLAB >> vcol = [ 1; 2; 3; 4; 5 ] >> vrow = [5 6 7 8 ], x = 3 The vcol = % Column vector semicolon 1 into vectors 2 provide 3 new row 4 5 vrow = % Row vector 5 6 7 8 Informationsteknologi x = % Scalar 3 Institutionen för informationsteknologi | www.it.uu.se Vectors Change individual elements >> vrad(1) = -1.1; vrad(2) = 3.5; >> vrad vrad = -1.1000 3.5000 >> vkol = vrad' %transpose vkol = -1.1000 3.5000 Informationsteknologi vrad(1) indicates that the index 1 (position 1) to be assigned. The ’ means transpose. Institutionen för informationsteknologi | www.it.uu.se 10 Generate vectors n Colon notation is often used to create vectors start:stride:stop if stride = 1 it can be omitted >> vektor = 0:5 vektor = 0 1 2 3 4 5 >> vektor2 = 0.0:0.05:2.0 vektor2 = Informationsteknologi 0 0.0500 0.1000 0.1500 ... 1.9500 2.0000 Institutionen för informationsteknologi | www.it.uu.se Generate vectors The command linspace also create vectors linspace(start,stop,elements) >> v = linspace(0,2,10) v = 0 0.2222 0.4444 0.6667 0.8889 1.1111 1.3333 1.5556 1.7778 2.0000 These two methods are used, for example, when creating the x-axis at the graphics Informationsteknologi Task: Create a vector in two different ways with equally spaced elements using stride 2*pi/100 in the interval [-pi, pi]. Institutionen för informationsteknologi | www.it.uu.se 11 Generate Matrices >> A = [1 7; 5 3]; ⎡1 7⎤ Create A = ⎢ ⎥ >> A ⎣5 3⎦ A = Semicolon or return 1 7 in the matrix gives a 5 3 new row >> A = [1 7 Semicolon in the end suppresses printing 5 3] A = Task: Create a 3x4 Informationsteknologi matrix and then 1 7 transpose it. 5 3 Institutionen för informationsteknologi | www.it.uu.se Creating a Matrix elementwise ⎡1 7⎤ A = ⎢ ⎥ ⎣5 3⎦ >> A(1,1)=1; A(1,2)=7; >> A(2,1)=5; A(2,2)=3; >> A A = 1 7 Informationsteknologi 5 3 Institutionen för informationsteknologi | www.it.uu.se 12 Special matrix commands n Available built-in >> B = ones(2,3) features to create the B = usual (and unusual) 1 1 1 matrices n Can create more 1 1 1 advanced matrices by >> eye(2) combinations of these ans = 1 0 eye(n) identity-matrix 0 1 ones(m,n) one-matrix zeros(m,n) zero-matrix >> C = zeros(2,2) rand(m,n) rand-matrix C = Informationsteknologi 0 0 + numerous other 0 0 commands Institutionen för informationsteknologi | www.it.uu.se Extending a matrix ⎡1 7⎤ Given A = ⎢ ⎥ >> A = [A; 2 1]; ⎣5 3⎦ alternative ⎡1 7⎤ create A ⎢5 3⎥ >> temp = [2 1]; = ⎢ ⎥ ⎣⎢2 1⎦⎥ >> A = [A; temp]; Separate row and column vectors! >> temp2 = [2;1]; >> A = [A; temp2]; ??? Error using ==> vertcat Informationsteknologi All rows in the bracketed expression must have the same number of columns. Institutionen för informationsteknologi | www.it.uu.se 13 Elements, rows and columns n One can work with individual elements, rows, columns, submatrices >> A(2,1) ans = 5 >> A(2,:) ans = 5 3 >> A(2,:) = [0 0] Colon (:) denotes the whole range (all rows A = or all columns) Informationsteknologi 1 7 0 0 2 1 Institutionen för informationsteknologi | www.it.uu.se Submatrices, colon notation Submatrices of the matrix A, mxn can be created quickly with colon notation n A(:,j) j:th column of A n A(i,:) i:th row of A n A(i:k,j:m) submatrix, rows i-k and cols j-m A = 1 7 6 0 0 5 Example, 2 1 3 Picking out this submatrix >> B = A(2:3,1:2) B = Informationsteknologi 0 0 2 1 Institutionen för informationsteknologi | www.it.uu.se 14 Workspace and Array Editor n If you double-click on a variable in Workspace a new window is opened, Array Editor Double- click on a variable in the Workspace Informationsteknologi n Here you can change the variable value but also size.
Recommended publications
  • A Comparative Evaluation of Matlab, Octave, R, and Julia on Maya 1 Introduction
    A Comparative Evaluation of Matlab, Octave, R, and Julia on Maya Sai K. Popuri and Matthias K. Gobbert* Department of Mathematics and Statistics, University of Maryland, Baltimore County *Corresponding author: [email protected], www.umbc.edu/~gobbert Technical Report HPCF{2017{3, hpcf.umbc.edu > Publications Abstract Matlab is the most popular commercial package for numerical computations in mathematics, statistics, the sciences, engineering, and other fields. Octave is a freely available software used for numerical computing. R is a popular open source freely available software often used for statistical analysis and computing. Julia is a recent open source freely available high-level programming language with a sophisticated com- piler for high-performance numerical and statistical computing. They are all available to download on the Linux, Windows, and Mac OS X operating systems. We investigate whether the three freely available software are viable alternatives to Matlab for uses in research and teaching. We compare the results on part of the equipment of the cluster maya in the UMBC High Performance Computing Facility. The equipment has 72 nodes, each with two Intel E5-2650v2 Ivy Bridge (2.6 GHz, 20 MB cache) proces- sors with 8 cores per CPU, for a total of 16 cores per node. All nodes have 64 GB of main memory and are connected by a quad-data rate InfiniBand interconnect. The tests focused on usability lead us to conclude that Octave is the most compatible with Matlab, since it uses the same syntax and has the native capability of running m-files. R was hampered by somewhat different syntax or function names and some missing functions.
    [Show full text]
  • Freemat V3.6 Documentation
    FreeMat v3.6 Documentation Samit Basu November 16, 2008 2 Contents 1 Introduction and Getting Started 5 1.1 INSTALL Installing FreeMat . 5 1.1.1 General Instructions . 5 1.1.2 Linux . 5 1.1.3 Windows . 6 1.1.4 Mac OS X . 6 1.1.5 Source Code . 6 2 Variables and Arrays 7 2.1 CELL Cell Array Definitions . 7 2.1.1 Usage . 7 2.1.2 Examples . 7 2.2 Function Handles . 8 2.2.1 Usage . 8 2.3 GLOBAL Global Variables . 8 2.3.1 Usage . 8 2.3.2 Example . 9 2.4 INDEXING Indexing Expressions . 9 2.4.1 Usage . 9 2.4.2 Array Indexing . 9 2.4.3 Cell Indexing . 13 2.4.4 Structure Indexing . 14 2.4.5 Complex Indexing . 16 2.5 MATRIX Matrix Definitions . 17 2.5.1 Usage . 17 2.5.2 Examples . 17 2.6 PERSISTENT Persistent Variables . 19 2.6.1 Usage . 19 2.6.2 Example . 19 2.7 STRING String Arrays . 20 2.7.1 Usage . 20 2.8 STRUCT Structure Array Constructor . 22 2.8.1 Usage . 22 2.8.2 Example . 22 3 4 CONTENTS 3 Functions and Scripts 25 3.1 ANONYMOUS Anonymous Functions . 25 3.1.1 Usage . 25 3.1.2 Examples . 25 3.2 FUNCTION Function Declarations . 26 3.2.1 Usage . 26 3.2.2 Examples . 28 3.3 KEYWORDS Function Keywords . 30 3.3.1 Usage . 30 3.3.2 Example . 31 3.4 NARGIN Number of Input Arguments . 32 3.4.1 Usage .
    [Show full text]
  • Towards a Fully Automated Extraction and Interpretation of Tabular Data Using Machine Learning
    UPTEC F 19050 Examensarbete 30 hp August 2019 Towards a fully automated extraction and interpretation of tabular data using machine learning Per Hedbrant Per Hedbrant Master Thesis in Engineering Physics Department of Engineering Sciences Uppsala University Sweden Abstract Towards a fully automated extraction and interpretation of tabular data using machine learning Per Hedbrant Teknisk- naturvetenskaplig fakultet UTH-enheten Motivation A challenge for researchers at CBCS is the ability to efficiently manage the Besöksadress: different data formats that frequently are changed. Significant amount of time is Ångströmlaboratoriet Lägerhyddsvägen 1 spent on manual pre-processing, converting from one format to another. There are Hus 4, Plan 0 currently no solutions that uses pattern recognition to locate and automatically recognise data structures in a spreadsheet. Postadress: Box 536 751 21 Uppsala Problem Definition The desired solution is to build a self-learning Software as-a-Service (SaaS) for Telefon: automated recognition and loading of data stored in arbitrary formats. The aim of 018 – 471 30 03 this study is three-folded: A) Investigate if unsupervised machine learning Telefax: methods can be used to label different types of cells in spreadsheets. B) 018 – 471 30 00 Investigate if a hypothesis-generating algorithm can be used to label different types of cells in spreadsheets. C) Advise on choices of architecture and Hemsida: technologies for the SaaS solution. http://www.teknat.uu.se/student Method A pre-processing framework is built that can read and pre-process any type of spreadsheet into a feature matrix. Different datasets are read and clustered. An investigation on the usefulness of reducing the dimensionality is also done.
    [Show full text]
  • The Freemat Primer Page 1 of 218 Table of Contents About the Authors
    The Freemat 4.0 Primer By Gary Schafer Timothy Cyders First Edition August 2011 The Freemat Primer Page 1 of 218 Table of Contents About the Authors......................................................................................................................................5 Acknowledgements...............................................................................................................................5 User Assumptions..................................................................................................................................5 How This Book Was Put Together........................................................................................................5 Licensing...............................................................................................................................................6 Using with Freemat v4.0 Documentation .............................................................................................6 Topic 1: Working with Freemat.................................................................................................................7 Topic 1.1: The Main Screen - Ver 4.0..................................................................................................7 Topic 1.1.1: The File Browser Section...........................................................................................10 Topic 1.1.2: The History Section....................................................................................................10 Topic 1.1.3: The
    [Show full text]
  • Freemat V4.0 Documentation
    FreeMat v4.0 Documentation Samit Basu October 4, 2009 2 Contents 1 Introduction and Getting Started 39 1.1 INSTALL Installing FreeMat . 39 1.1.1 General Instructions . 39 1.1.2 Linux . 39 1.1.3 Windows . 40 1.1.4 Mac OS X . 40 1.1.5 Source Code . 40 2 Variables and Arrays 41 2.1 CELL Cell Array Definitions . 41 2.1.1 Usage . 41 2.1.2 Examples . 41 2.2 Function Handles . 42 2.2.1 Usage . 42 2.3 GLOBAL Global Variables . 42 2.3.1 Usage . 42 2.3.2 Example . 42 2.4 INDEXING Indexing Expressions . 43 2.4.1 Usage . 43 2.4.2 Array Indexing . 43 2.4.3 Cell Indexing . 46 2.4.4 Structure Indexing . 47 2.4.5 Complex Indexing . 49 2.5 MATRIX Matrix Definitions . 49 2.5.1 Usage . 49 2.5.2 Examples . 49 2.6 PERSISTENT Persistent Variables . 51 2.6.1 Usage . 51 2.6.2 Example . 51 2.7 STRUCT Structure Array Constructor . 51 2.7.1 Usage . 51 2.7.2 Example . 52 3 4 CONTENTS 3 Functions and Scripts 55 3.1 ANONYMOUS Anonymous Functions . 55 3.1.1 Usage . 55 3.1.2 Examples . 55 3.2 FUNCTION Function Declarations . 56 3.2.1 Usage . 56 3.2.2 Examples . 57 3.3 KEYWORDS Function Keywords . 60 3.3.1 Usage . 60 3.3.2 Example . 60 3.4 NARGIN Number of Input Arguments . 61 3.4.1 Usage . 61 3.4.2 Example . 61 3.5 NARGOUT Number of Output Arguments .
    [Show full text]
  • Sageko Matlabin Korvaaja?
    Mikko Moilanen Sageko Matlabin korvaaja? Opinnäytetyö Tietotekniikan koulutusohjelma Elokuu 2012 KUVAILULEHTI Opinnäytetyön päivämäärä 4.9.2012 Tekijä(t) Koulutusohjelma ja suuntautuminen Mikko Moilanen Tietotekniikan koulutusohjelma Nimeke Sageko Matlabin korvaaja? Tiivistelmä Tässä insinöörityössä tutkitaan voiko Sagella korvata Matlabin korkeakouluopinnoissa matemaattisen analyysin opiskelutyövälineenä. Tutkimuksen perusteella arvioidaan, että onko Sagella tulevaisuutta ohjelmistona, varmistetaan Sagen toimivuus matemaattisessa analyysissa ja selvitetään, että miten helppoa yksittäisen käyttäjän on ottaa Sage käyttöön ja miten oppilaitos saa Sagen käyttöönsä. Matlab on kiistaton standardiohjelmisto matemaattisessa mallinnuksessa ja analyysissa. Sen peruslisenssimaksut ja Toolboxien lisenssimaksut ovat kuitenkin kohonneet ehkä juuri tästä syystä korkeiksi ja mikään ei estä lisenssimaksujen jatkuvaa kohoamista. Näin ollen halvemman vaihtoehdon löytäminen Matlabille korkeakouluopintojen työvälineenä on mielenkiintoinen ja hyödyllinen tutkimuskohde. Eräs mielenkiintoinen vaihtoehto Matlabille on Sage, koska se kokoaa lähes 100 matemaattista laskentaohjelmistoa yhden ja saman käyttöliittymän alle. Sage on myös suunniteltu toimimaan palvelin/asiakas -mallilla WWW-selaimella, mistä voi olla erityistä hyötyä laajoissa asennuksissa ylläpidon ja luokkahuoneidan varaamisen kannalta . Tutkimuksen tuloksena havaittiin Sagen olevan niin erilainen ja epäyhteensopiva Matlabin kanssa, että Matlab ei ole suoraan korvattavissa Sagella. Sen sijaan todettiin,
    [Show full text]
  • They Have Very Good Docs At
    Intro to the Julia programming language Brendan O’Connor CMU, Dec 2013 They have very good docs at: http://julialang.org/ I’m borrowing some slides from: http://julialang.org/blog/2013/03/julia-tutorial-MIT/ 1 Tuesday, December 17, 13 Julia • A relatively new, open-source numeric programming language that’s both convenient and fast • Version 0.2. Still in flux, especially libraries. But the basics are very usable. • Lots of development momentum 2 Tuesday, December 17, 13 Why Julia? Dynamic languages are extremely popular for numerical work: ‣ Matlab, R, NumPy/SciPy, Mathematica, etc. ‣ very simple to learn and easy to do research in However, all have a “split language” approach: ‣ high-level dynamic language for scripting low-level operations ‣ C/C++/Fortran for implementing fast low-level operations Libraries in C — no productivity boost for library writers Forces vectorization — sometimes a scalar loop is just better slide from ?? 2012 3 Bezanson, Karpinski, Shah, Edelman Tuesday, December 17, 13 “Gang of Forty” Matlab Maple Mathematica SciPy SciLab IDL R Octave S-PLUS SAS J APL Maxima Mathcad Axiom Sage Lush Ch LabView O-Matrix PV-WAVE Igor Pro OriginLab FreeMat Yorick GAUSS MuPad Genius SciRuby Ox Stata JLab Magma Euler Rlab Speakeasy GDL Nickle gretl ana Torch7 slide from March 2013 4 Bezanson, Karpinski, Shah, Edelman Tuesday, December 17, 13 Numeric programming environments Core properties Dynamic Fast? and math-y? C/C++/ Fortran/Java − + Matlab + − Num/SciPy + − R + − Older table: http://brenocon.com/blog/2009/02/comparison-of-data-analysis-packages-r-matlab-scipy-excel-sas-spss-stata/ Tuesday, December 17, 13 - Dynamic vs Fast: the usual tradeof - PL quality: more subjective.
    [Show full text]
  • Pipenightdreams Osgcal-Doc Mumudvb Mpg123-Alsa Tbb
    pipenightdreams osgcal-doc mumudvb mpg123-alsa tbb-examples libgammu4-dbg gcc-4.1-doc snort-rules-default davical cutmp3 libevolution5.0-cil aspell-am python-gobject-doc openoffice.org-l10n-mn libc6-xen xserver-xorg trophy-data t38modem pioneers-console libnb-platform10-java libgtkglext1-ruby libboost-wave1.39-dev drgenius bfbtester libchromexvmcpro1 isdnutils-xtools ubuntuone-client openoffice.org2-math openoffice.org-l10n-lt lsb-cxx-ia32 kdeartwork-emoticons-kde4 wmpuzzle trafshow python-plplot lx-gdb link-monitor-applet libscm-dev liblog-agent-logger-perl libccrtp-doc libclass-throwable-perl kde-i18n-csb jack-jconv hamradio-menus coinor-libvol-doc msx-emulator bitbake nabi language-pack-gnome-zh libpaperg popularity-contest xracer-tools xfont-nexus opendrim-lmp-baseserver libvorbisfile-ruby liblinebreak-doc libgfcui-2.0-0c2a-dbg libblacs-mpi-dev dict-freedict-spa-eng blender-ogrexml aspell-da x11-apps openoffice.org-l10n-lv openoffice.org-l10n-nl pnmtopng libodbcinstq1 libhsqldb-java-doc libmono-addins-gui0.2-cil sg3-utils linux-backports-modules-alsa-2.6.31-19-generic yorick-yeti-gsl python-pymssql plasma-widget-cpuload mcpp gpsim-lcd cl-csv libhtml-clean-perl asterisk-dbg apt-dater-dbg libgnome-mag1-dev language-pack-gnome-yo python-crypto svn-autoreleasedeb sugar-terminal-activity mii-diag maria-doc libplexus-component-api-java-doc libhugs-hgl-bundled libchipcard-libgwenhywfar47-plugins libghc6-random-dev freefem3d ezmlm cakephp-scripts aspell-ar ara-byte not+sparc openoffice.org-l10n-nn linux-backports-modules-karmic-generic-pae
    [Show full text]
  • Lab 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 models 3. Write script files to save, edit and debug MATLAB commands 4. Solve systems of equations Key Prerequisites None Required Resources Access to MATLAB (buy here) or FreeMat (download here) Circuit analysis is often a computationally challenging activity. Even powerful programmable calculators can be inadequate to the task. In this lab we develop some basic proficiency with MATLAB and its red-haired cousin FreeMat, so that you can use these tools for your homework and future lab activities. You are welcome to use MATLAB or FreeMat for this lab. Since most people will probably be using FreeMat on their home computers, this lab will illustrate concepts with FreeMat. For what we will be using them for, however, the two are almost identical. 1 Lab 1: Intro to MATLAB and FreeMat Vocabulary All key vocabulary used in this lab are listed below, with closely related words listed together: variable, function vector, array plot, axes, legend script file Discussion and Procedure Part 1. Basics and Simple Arithmetic Before we begin, we’ll need to identify the main components of the MATLAB/FreeMat environment, shown in figure 1. These include the Current Directory, indicating what folder you are looking at in the “Listing of Current Directory” window. You can change the current directory by clicking the manila folder to the right of the Current Directory. Figure 1. The FreeMat Environment 2 Lab 1: Intro to MATLAB and FreeMat We spend much of our time in MATLAB working in the Command Window, which is where we type instructions.
    [Show full text]
  • A Comparative Evaluation of Matlab, Octave, Freemat, and Scilab for Research and Teaching
    A COMPARATIVE EVALUATION OF MATLAB, OCTAVE, FREEMAT, AND SCILAB FOR RESEARCH AND TEACHING Neeraj Sharma and Matthias K. Gobbert Department of Mathematics and Statistics, University of Maryland, Baltimore County {nsharma1,gobbert}@umbc.edu Technical Report HPCF–2010–7, www.umbc.edu/hpcf > Publications Abstract: The commercial software package Matlab is the most widely used numerical compu- tational package. GNU Octave, FreeMat, and Scilab are other numerical computational packages that have many of the same features as Matlab. Unlike Matlab, the other three packages are free of charge to the user and easily available to download to Linux, Windows, or Mac OS X operating systems. Are these packages viable alternatives to Matlab for uses in research or teaching? We review in depth the basic operations of Matlab, such as solving a system of linear equations, com- puting eigenvalues and eigenvectors, and plotting in two-dimensions. In addition, we research a more complex test problem resulting from a finite difference discretization of the Poisson equation in two spatial dimensions. Then, we compare the results we receive from GNU Octave, FreeMat, and Scilab to our previously found Matlab results. All packages gave identical numerical results, though Scilab exhibited a limitation in the size of the linear system it could solve in the complex test problem and FreeMat was hampered by the lack of a conjugate gradient function. The available graphical functions differ in functionality, but give equivalent plots, though FreeMat has limited three-dimensional graphics capabilities at present. Based on these tests, we conclude that GNU Octave is the most compatible with Matlab due to its numerical abilities and the similarity of its syntax.
    [Show full text]
  • Freemat: Why Are We Doing This and How Do I Get Started?
    FreeMat: Why are we doing this and how do I get started? Bruce Emerson∗ COCC Science Department (Dated: September 16, 2013) This short (hopefully) document will attempt to provide a rationale for compelling students in my physics classes to learn how to use FreeMat (a MATLAB clone) to present and analyze data and generate appropriate graphics for use in their lab reports and other documents. Like learning to use LATEX this is another skill set that is widely, though not universally, used across the scientific and engineering disciplines. Additionally this document will provide basic guidance for installing the software on your personal computer and generating some basic outputs relevant to labs. 1. WHY? ming. In Electrical Fundamentals there is a simulation program called SPICE which shares many coding fea- This is, of course, the fundamental question. Why tures with all the math engines. might you see it as valid to spend the effort, and it will Think of it this way: If you open up the hood of your take effort, to learn how to use a math calculating engine car and learn how the various systems look and interact like FreeMat? On a philosophical level I would suggest you then understand better how a car functions. While it that your are in a physics class to engage with the pro- is true that different manufacturers use different specific cess of figuring out how the universe works. Physics, and parts providers you still understand a great deal about all the sciences, are engaged in the effort to 'look under how a Ford truck works if you know how your Toyota the hood' of Mother Nature and try understand how it Camry works.
    [Show full text]
  • Mathematical Software Tools Applicable to Remote Learning and Scientific Research in Case of Isolation
    INTERNATIONAL SCIENTIFIC JOURNAL "MATHEMATICAL MODELING" WEB ISSN 2603-2929; PRINT ISSN 2535-0986 Mathematical software tools applicable to remote learning and scientific research in case of isolation Svilen Rachev1, Milena Racheva1, Andrey Andreev1,2, Dobrin Ganchev1 Technical University of Gabrovo, Bulgaria1 Bulgarian Academy of Science, Sofia, Bulgaria2 [email protected] Abstract: This paper is devoted to some up-to-date computational tools, which are on-line available and appropriate to remote learning as well as to scientific research implementation relevant to mathematics and their applications. The following aspects are concerned and discussed: some of the opportunities and benefits afforded by the software tools which are taken into consideration; necessary requirements which have to be met in order to use these tools; some disadvantages and drawbacks which may arise. Comparison of fees and prices for different mathematical software tools is done. For purpose of illustration realistic examples are also given. Keywords: MATHEMATICAL SOFTWARE, COMPUTER ALGEBRA SYSTEMS, FREE SOFTWARE, CLOUD COMPUTING 1. Introduction implementation and an environment in which the language to be used. Nowadays, the mathematical software tools used in research This means that, using CAS, one may manipulate mathematical and engineering play a crucial role in the development of expressions in a way as if he do it manually. technology, education and science. For example, the treatment of complex numerical analysis with the aid of mathematical software Computer algebra systems can be conditionally divided into two is currently used in all branches of physical, medical and social types: sciences. For that matter, by means of Computer aided design (CAD) software the level of scientific research and in particular of specialized, which are devoted to a specific part of engineering science can be significantly improved.
    [Show full text]