Lecture 1 arithmetic and functions

Size: px
Start display at page:

Download "Lecture 1 arithmetic and functions"

Transcription

1 Lecture 1 arithmetic and functions MATH 190 WEBSITE: Open MATH 190 in a web browser. Read and accept the Terms of Acceptable Lab Use. Open Lecture 1. PREREQUISITE: You must have taken or be taking Calculus I concurrently. If not taken here, specify the college and course title/number. Otherwise, drop this class now. If you don t need Matlab or Fortran, maybe you shouldn t be in this class. Choose your seat carefully, it will be your seat for rest of the term. Your computer s LabPC number is on the top of its case. Locate that number in the sign-up sheet. Print and sign your name there. Record: LabPC #, login name, password. MATLAB (SCILAB) AND FORTRAN Javascript programs webpages. Perl, Python, PHP program webservers. Large team-programming projects use C++ or Java. Fortran (in engineering) and C (most other areas) are used when maximum speed (math/engineering applications). Mathematica, Maple and Matlab (in engineering) are used for symbolic math (handling formulas rather than numbers). This course teaches Matlab (easier to use but slower) and Fortran (the fastest programming language but more advanced). These languages have the biggest engineering program libraries. First five weeks are Matlab, the rest is Fortran. On your home computer (1) install a free version of Matlab (Scilab) and (2) a compiler (g95.exe or gfortran) and editor (SciTE) for Fortran. Go to the class website ( for instructions on both Scilab and Fortran. Have Scilab, Fortran and SciTE up and running by the next class (if you can t get either g95 or gfortran installed, this course might be hard). Warning: installing Fortran is hard for Macs, Windows 8. ARITHMETIC Double-click the Scilab icon (top center, black with red dots). Enter the following: (active participation is required) 3+2 3*2 3/2 3^2 3**2 In Matlab, use ^ or ** for exponentiation. In Fortran, use only ** not ^. VARIABLES a variables must be initialized a = 2 a=2 spaces don t matter a A Matlab is case sensitive, Fortran is not. b=3 a+b ab a*b must use * for products, ab is two-letter variable name it is not a*b cost=1000*(1.05)^8 cost is a variable just like x, y, z

2 ( )'S PRECEDENCE ^, then * and /, then + and -. Hence a*b^2-4*d = (a*(b^2))-(4*d) a*b/c*d =? add ( ) s to remove unambiguity. (a*b)/(c*d) a*(b/c)*d a+b-c+d =? rewrite with added ( ) s (a+b)-(c+d) a+(b-c)+d) Be able (on next time s quiz) to calculate the following values: 1* *3 2^2*3 2^(2*3) -2^2 (-2)^2 modulo(13,5) the remainder of 13/5, mod(13,5) in Fortran floor(13/5) no built-in quotient function but this works. ASSIGNMENTS AND EQUALITY TESTS. In math, x 2 means x equals 2. In MatLab, x 2 is the assignment command which sets x equal to 2 (any earlier value is lost). To test if x equals 2 in Matlab or Fortran, write x= =2. x variables must be initialized x=2 x= =2 T = "True" x= =0 F = "False" x= =x+1 is always false. x=x+1 new value on left, old value on right - increments value x+1=x wrong, need variable on the left, formula on right x=input('enter a number. > ') gets x from keyboard x<=3 test if x 3 x>=3 test if x 3 x~=3 test if x 3 (x/=3 in fortran, x!=3 in PHP, C) c1.0(3) Together. Write a function even_odd(n) which returns even if n is even, odd if not. Test it on 0, 1,..., 9. // c1.0(3) Function even_odd(n) Test it on 0, 1,..., 9. Write functions in SciNotes, not in Scilab. Click Applications/SciNotes to open SciNotes. Copy the comment line // c1.0(3)... as the first line. Write the function, Write lines which test it. Select Execute... file with echo or <ctrl-l>. Note the answers in the Scilab window. File/Save as c0.1(3), save in drive H: Once a function has been executed, you can use it in Scilab. Go back to Scilab and enter: even_odd(0)

3 CLASSWORK PROBLEM DUE NOW c1.0(3) subject line: 190 c1(3) vopen/write/compose a new message. Open a browser-based client. E.g. Gmail, Hotmail, Yahoo or click the UH Webmail link on our class website, or go to your MyUH account. vcopy/paste this classwork problem from SciNotes (never from Scilab) into the message body: highlight the lines to be copied <ctrl-a>, press <ctrl-c> or select edit/copy, put the cursor in the message, press <ctrl-v> or select edit/paste. Don t attach files (attachments get scrubbed). Do not add anything else to the , not even a problem number or your name. If you must add a comment, put // before the comment so it won t give errors in Scilab. v Copy/paste the subject line exactly. Send your . HOMEWORK 1 DUE BEFORE THE NEXT CLASS to: dale@math.hawaii.edu subject line: 190 h1(4) Don t attach files. h1.1(4) On the class website, click Fortran and follow the instructions to install Fortran and SciTE. Compile and execute (as shown in the above instructions in the section "Compiling and executing") the following file. Save it as fortran_test.f95 program fortran_test integer i character(6) xx do i = 0, 6 xx = xx(1:i) // char(i+60) enddo print *, xx end Send me the 6 characters this program gives when run. to: dale@math.hawaii.edu, subject line: 190 h0(4) Note: Fortran installation can be hard, expecially on Macs. On Macs, gfortran is more likely to install than g95. For Windows 8, try the SimplyFortran compilers at the bottom of the Windows Installation page. Or maybe try FTN95. PRINTING SUPPRESSION x=0 x=1; x To suppress printing to the monitor, end lines with ;. MULTIPLE COMMANDS PER LINE To enter several commands on the same line, separate them with ; (no printing) or, (printing). x=1, x=x+1, x=x^2 Homework prob. 2.1, 2.2 x=1; x=x+1; x=x^2 What is printed? (on the next quiz)

4 CONSTANTS AND BUILT-IN FUNCTIONS x=100 %pi = = %e = log(x) =ln(x), the natural logarithm log10(x) common base-10 logarithm sqrt(4) 4 abs(-3) absolute value -3 round(4.5) rounds to nearest integer (5 in this case). ceil(4.5) rounds up to nearest >= integer. >= means > floor(4.5) rounds down to nearest <= integer. <= means < factorial(3) = 3! = 3*2*1 sin(%pi/2) angles are in radians, not degrees The trig functions sin, cos, tan are in radians. Their inverses: sin 1,cos 1,tan 1 are also written arcsin, arcsin, arctan. In Matlab/Scilab they are written atan, asin, acos. rand() rand() rand() returns a random number between 0 and 1 COMMENTS In Scilab // indicates a comment which Scilab ignores. In Matlab % precedes comments; in Fortran it is!. One of the next two lines gives an error. log(%e) natural logarithm log(%e) //natural logarithm SAVING a=[1,2,3; 4,5,6] When you close Scilab, all values are lost. Here s how to save a and all other entered data to some file, say x1.sav with extension.sav. Select file/save environment from the top left menu. Select Drive H: in the Save in: box. Enter prob1.sav in the File name: box. a clear //clears all variables, clear a,x clears just a and x a To load the saved data, select file/load environment (not file/open...) and select the filename. HELP To get help enter: help To get help about matrices, enter help matrix ERRORS Scilab/Matlab has no mouse cursor (when a cursor is needed, use the SciNotes editor window). Fix typos, with the backspace (destructive) or back arrow key (nondestructive). Copy/paste the next line then press <enter> sin[pi*x/12) Retrieve this line using the up arrow. Use the back arrow key to correct. sin(%pi*x/12) should get

5 MATLAB VARIABLES ARE INDEPENDENT x=2 f=2*x x=3 f //changing x doesn t change f, it is a memory location. Matlab variables are independent (they don t depend on other variables). To make f a dependent variable that depends on x, define it as a function f(x). WRITE FUNCTIONS IN SCINOTES -- The mouse cursor doesn t work in SciLab but does work in SciNotes. Do all classwork and homework in SciNotes, never in the SciLab (you lose 1 point for entering homework in Scilab). DEFINING FUNCTIONS Classwork prob. 2.1, 2.2, 2.3, 2.4, hw 2.3, 2.4. Write a function vol_sphere(r) which gives the volume 4 r 3 3 of a sphere of radius r. Reminder, do this in SciNotes. Go to the SciNotes window Select File/New (or <ctrl-n>). Copy/paste the next 4 lines to SciNotes (SciNotes, not SciLab). function V=vol_sphere(r) V=4*%pi*r^3/3; endfunction vol_sphere(6) //answer = Saving: click File/Save, enter a file name, click save. Entering vol_sphere makes a file vol_sphere.sce To open this file in a later session, click File/Open, select the file name. Select Execute... file with echo or <ctrl-l> Once a function has been executed, it may be used in Scilab. Go to the Scilab window and enter vol_sphere(10) this gives the volume of a sphere of radius 10 Note: vol_sphere is the function name. V is the output variable. To call the function, use the name, not the output variable. To find the volume of a sphere of radius 10, write vol_sphere(10), not V. b For every function you define, always add at least one line after the function which tests it. List the assignment name and describe the function in an initial comment line. HOMEWORK 0 IS DUE BEFORE THE NEXT CLASS CLOSED-BOOK QUIZ AT BEGINNING OF CLASS - BE ON TIME No computer, no notes, no text. 1(3) Define a given function (e.g. Vol_sphere), 2(1) Problem like What is printed? x=1; x=x+1; x=x^2. x 3(2) Write a Scilab formula such as. Answer here x 2 e would be (sqrt(x-%pi))/(x^2-%e) A score < 50% is an F. Imperative sentences are in green. They give instructions for classwork and homework. Information is carried in the black declarative sentences. Scilab code is in monospaced font.

6 SCILAB INSTALLATION, TEXTS To install Scilab on your home computer, go to select Scilab. Follow the instructions. Also note the three Scilab online texts listed here. C students will need more explanations and examples than my one-hour lectures provide. Either read the Matlab text (which occasionally differs from Scilab) or use one of the Scilab texts listed on the class website. ERRORS The most common problems are putting lines in the text such as Problem 1 which are not Scilab code. If you must include such lines, comment them out //Problem 1. If your copied text won t paste into your , make sure plain text is selected or use paste without formatting or try <Shift-Control v> to paste without formatting. Formatted text in can cause errors in Scilab. To check that your ed answers will run in Scilab, highlight the entire message <ctrl-a>, copy <ctrl-c> then paste into Scilab. The problems should run, one after the other, without errors. Copy/paste text to your s, don t attach files. To avoid virus infections, attached files are not executed. SCILAB DISPLAY (OPTIONAL) When you change a function, you often get a function being redefined error. It also echoes the line being run. To disable this enter mode(0),warning( off ) in SciNotes. To get rid of the ans = message, use the disp(... ) function. Pressing <F2> clears Scilab s console window. To stop auto-completion in SciNotes, click Preferences and uncheck both Auto completion lines. TEXTBOOK Everything on the quizzes and exams will be from the lectures not the textbook. If you are in the upper half of the class, the lecture notes should suffice. If you are in the lower half of the class, there will be things you don t understand even after studying a lecture. In this case you will need to study the reading assignment given for that lecture. If you don t understand how programs and functions operate, you won t be able to pass the exams.

3+2 3*2 3/2 3^2 3**2 In matlab, use ^ or ** for exponentiation. In fortran, use only ** not ^ VARIABLES LECTURE 1: ARITHMETIC AND FUNCTIONS

3+2 3*2 3/2 3^2 3**2 In matlab, use ^ or ** for exponentiation. In fortran, use only ** not ^ VARIABLES LECTURE 1: ARITHMETIC AND FUNCTIONS LECTURE 1: ARITHMETIC AND FUNCTIONS MATH 190 WEBSITE: www.math.hawaii.edu/ gautier/190.html PREREQUISITE: You must have taken or be taking Calculus I concurrently. If not taken here, specify the college

More information

190 Lecture 11 Fortran arithmetic

190 Lecture 11 Fortran arithmetic 190 Lecture 11 Fortran arithmetic Open Lecture 1. Open SciTE (black death star) not Scilab We cover these chapters of your Fortran text: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Reading assignment:

More information

190 Lecture 11 Fortran arithmetic

190 Lecture 11 Fortran arithmetic 190 Lecture 11 Fortran arithmetic Open Lecture 1. Open SciTE (black death star) not Scilab We cover these chapters of your Fortran text: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Reading assignment:

More information

190 Lecture 11 Fortran arithmetic

190 Lecture 11 Fortran arithmetic 190 Lecture 11 Fortran arithmetic Open Lecture 1. Open SciTE (black death star) not Scilab We cover these chapters of your Fortran text: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Reading assignment:

More information

1 0 3 y 2. In SciNotes, enter the augmented matrix, then rref(a).

1 0 3 y 2. In SciNotes, enter the augmented matrix, then rref(a). 190 Lecture 5 equations graphs integrals Open MATH 190 in a browser; select Lecture 5 Double-click the SciLab icon. See Chapter 3, 10 of text for details. SOLVING SIMULTANEOUS EQUATIONS. EXAMPLE e4.1 Solve

More information

SOLVING SIMULTANEOUS EQUATIONS. EXAMPLE e4.1 Solve Corresponding augmented matrix 2x 4y 2 a 242 x 3y 3

SOLVING SIMULTANEOUS EQUATIONS. EXAMPLE e4.1 Solve Corresponding augmented matrix 2x 4y 2 a 242 x 3y 3 190 Lecture 5 equations graphs integrals Open MATH 190 in a browser; select Lecture 5 Double-click the SciLab icon. See Chapter 3, 10 of text for details. SOLVING SIMULTANEOUS EQUATIONS. EXAMPLE e4.1 Solve

More information

Introduction to Engineering gii

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

More information

Math 2250 MATLAB TUTORIAL Fall 2005

Math 2250 MATLAB TUTORIAL Fall 2005 Math 2250 MATLAB TUTORIAL Fall 2005 Math Computer Lab The Mathematics Computer Lab is located in the T. Benny Rushing Mathematics Center (located underneath the plaza connecting JWB and LCB) room 155C.

More information

Dr Richard Greenaway

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

More information

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3. MATLAB Introduction Accessing Matlab... Matlab Interface... The Basics... 2 Variable Definition and Statement Suppression... 2 Keyboard Shortcuts... More Common Functions... 4 Vectors and Matrices... 4

More information

Midterm Lectures 1-10 Lecture 1 arithmetic and functions

Midterm Lectures 1-10 Lecture 1 arithmetic and functions Midterm Lectures 1-10 Lecture 1 arithmetic and functions MATH 190 WEBSITE: math.hawaii.edu/190 Open this in Chrome (not Firefox). Read and accept the Terms of Acceptable Lab Use. Open Lecture 1. Open Scilab.

More information

Basic stuff -- assignments, arithmetic and functions

Basic stuff -- assignments, arithmetic and functions Basic stuff -- assignments, arithmetic and functions Most of the time, you will be using Maple as a kind of super-calculator. It is possible to write programs in Maple -- we will do this very occasionally,

More information

Codes and Coding. Objectives: Related Careers

Codes and Coding. Objectives: Related Careers Codes and Coding Objectives: 1. Students will become aware of several different programming code languages and be able to identify similarities and differences between them. 2. Students will learn how

More information

LAB 1 General MATLAB Information 1

LAB 1 General MATLAB Information 1 LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by

More information

Matlab as a calculator

Matlab as a calculator Why Matlab? Matlab is an interactive, high-level, user-friendly programming and visualization environment. It allows much faster programs development in comparison with the traditional low-level compiled

More information

Lab#1: INTRODUCTION TO DERIVE

Lab#1: INTRODUCTION TO DERIVE Math 111-Calculus I- Fall 2004 - Dr. Yahdi Lab#1: INTRODUCTION TO DERIVE This is a tutorial to learn some commands of the Computer Algebra System DERIVE. Chapter 1 of the Online Calclab-book (see my webpage)

More information

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Lecture 1 Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Welcome to ENGR 102 Syllabus review Your Time Expectations (in

More information

CLASSWORK 12.1(2) sign_of.f95 Write a function. EXAMPLE conversion.f95

CLASSWORK 12.1(2) sign_of.f95 Write a function. EXAMPLE conversion.f95 190 Lecture 12 Subroutines, logic Open Lecture 11. Open SciTE (black death star) not Scilab We cover these chapters of your Fortran text: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Reading assignment:

More information

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB? Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science

More information

Lab 1 Intro to MATLAB and FreeMat

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

More information

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

Numerical Methods Lecture 1

Numerical Methods Lecture 1 Numerical Methods Lecture 1 Basics of MATLAB by Pavel Ludvík The recommended textbook: Numerical Methods Lecture 1 by Pavel Ludvík 2 / 30 The recommended textbook: Title: Numerical methods with worked

More information

190 Lecture 15 allocation, formatting

190 Lecture 15 allocation, formatting 190 Lecture 15 allocation, formatting We cover the chapters of your Fortran text listed in the syllabus two at a time: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Reading assignment: chapters. 9,

More information

Computer Programming in MATLAB

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

General MATLAB Information 1

General MATLAB Information 1 Introduction to MATLAB General MATLAB Information 1 Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting

More information

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT

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

More information

Introduction to GNU-Octave

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

SOLVING SIMULTANEOUS EQUATIONS. Builtin rref(a) EXAMPLE E4.1 Solve Corresponding augmented matrix 2x 4y 2 a 242 x 3y 3

SOLVING SIMULTANEOUS EQUATIONS. Builtin rref(a) EXAMPLE E4.1 Solve Corresponding augmented matrix 2x 4y 2 a 242 x 3y 3 Lecture 4 matrices and progressions Open Lecture 4 on class website: www.math.hawaii.edu/190 ELEMENTARY ROW OPERATIONS swap mult add_mult Given a matri, there are three types of elementary row operations:

More information

190 Lecture 13 recursion, vectors subroutines

190 Lecture 13 recursion, vectors subroutines 190 Lecture 13 recursion, vectors subroutines Open SciTE, Lect. 7 We cover these chapters of your Fortran text: 7&8, 9&10, 11&12, 13&14, 15&16, 17&18, 19&22, 23. Current reading assignment: chapters 8,

More information

ELEMENTARY MATLAB PROGRAMMING

ELEMENTARY MATLAB PROGRAMMING 1 ELEMENTARY MATLAB PROGRAMMING (Version R2013a used here so some differences may be encountered) COPYRIGHT Irving K. Robbins 1992, 1998, 2014, 2015 All rights reserved INTRODUCTION % It is assumed the

More information

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

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

More information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

Introduction to Programming with RAPTOR

Introduction to Programming with RAPTOR Introduction to Programming with RAPTOR By Dr. Wayne Brown What is RAPTOR? RAPTOR is a visual programming development environment based on flowcharts. A flowchart is a collection of connected graphic symbols,

More information

AMS 27L LAB #1 Winter 2009

AMS 27L LAB #1 Winter 2009 AMS 27L LAB #1 Winter 2009 Introduction to MATLAB Objectives: 1. To introduce the use of the MATLAB software package 2. To learn elementary mathematics in MATLAB Getting Started: Log onto your machine

More information

McTutorial: A MATLAB Tutorial

McTutorial: A MATLAB Tutorial McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB

More information

Lecture 1: Hello, MATLAB!

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

This is a basic tutorial for the MATLAB program which is a high-performance language for technical computing for platforms:

This is a basic tutorial for the MATLAB program which is a high-performance language for technical computing for platforms: Appendix A Basic MATLAB Tutorial Extracted from: http://www1.gantep.edu.tr/ bingul/ep375 http://www.mathworks.com/products/matlab A.1 Introduction This is a basic tutorial for the MATLAB program which

More information

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

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

More information

Computer Project: Getting Started with MATLAB

Computer Project: Getting Started with MATLAB Computer Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands. Examples here can be useful for reference later. MATLAB functions: [ ] : ; + - *

More information

Chapter 1 Introduction to MATLAB

Chapter 1 Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,

More information

Introduction to MATLAB

Introduction to MATLAB Outlines September 9, 2004 Outlines Part I: Review of Previous Lecture Part II: Part III: Writing MATLAB Functions Review of Previous Lecture Outlines Part I: Review of Previous Lecture Part II: Part III:

More information

MATLAB Project: Getting Started with MATLAB

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

The Very Basics of the R Interpreter

The Very Basics of the R Interpreter Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open

More information

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word These instructions assume that you are familiar with using MS Word for ordinary word processing *. If you are not comfortable entering

More information

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

Starting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to. Starting Matlab Go to MATLAB Laboratory 09/09/10 Lecture Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu http://ctx.loyola.edu and login with your Loyola name and password...

More information

Why use MATLAB? Mathematcal computations. Used a lot for problem solving. Statistical Analysis (e.g., mean, min) Visualisation (1D-3D)

Why use MATLAB? Mathematcal computations. Used a lot for problem solving. Statistical Analysis (e.g., mean, min) Visualisation (1D-3D) MATLAB(motivation) Why use MATLAB? Mathematcal computations Used a lot for problem solving Statistical Analysis (e.g., mean, min) Visualisation (1D-3D) Signal processing (Fourier transform, etc.) Image

More information

A Guide to Using Some Basic MATLAB Functions

A Guide to Using Some Basic MATLAB Functions A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available

More information

INTRODUCTION TO DERIVE - by M. Yahdi

INTRODUCTION TO DERIVE - by M. Yahdi Math 111/112-Calculus I & II- Ursinus College INTRODUCTION TO DERIVE - by M. Yahdi This is a tutorial to introduce main commands of the Computer Algebra System DERIVE. You should do (outside of class)

More information

1 Introduction to Matlab

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

Albertson AP Calculus AB AP CALCULUS AB SUMMER PACKET DUE DATE: The beginning of class on the last class day of the first week of school.

Albertson AP Calculus AB AP CALCULUS AB SUMMER PACKET DUE DATE: The beginning of class on the last class day of the first week of school. Albertson AP Calculus AB Name AP CALCULUS AB SUMMER PACKET 2017 DUE DATE: The beginning of class on the last class day of the first week of school. This assignment is to be done at you leisure during the

More information

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

Outline. CSE 1570 Interacting with MATLAB. Outline. Starting MATLAB. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An. CSE 10 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following

More information

Chapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1

Chapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1 Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values

More information

Finding, Starting and Using Matlab

Finding, Starting and Using Matlab Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col

More information

GRAPH 4.4. Megha K. Raman APRIL 22, 2015

GRAPH 4.4. Megha K. Raman APRIL 22, 2015 GRAPH 4.4 By Megha K. Raman APRIL 22, 2015 1. Preface... 4 2. Introduction:... 4 3. Plotting a function... 5 Sample funtions:... 9 List of Functions:... 10 Constants:... 10 Operators:... 11 Functions:...

More information

Starting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.

Starting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below. What is MATLAB? MATLAB (short for MATrix LABoratory) is a language for technical computing, developed by The Mathworks, Inc. (A matrix is a rectangular array or table of usually numerical values.) MATLAB

More information

Excel Tool: Calculations with Data Sets

Excel Tool: Calculations with Data Sets Excel Tool: Calculations with Data Sets The best thing about Excel for the scientist is that it makes it very easy to work with data sets. In this assignment, we learn how to do basic calculations that

More information

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

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An. CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some

More information

Computer Science 102. Into to Computational Modeling Special Topics: Programming in Matlab

Computer Science 102. Into to Computational Modeling Special Topics: Programming in Matlab Computer Science 102 Into to Computational Modeling Special Topics: Programming in Matlab Matlab An integrated programming and graphical environment Interpreted : interactive; get answer immediately Also

More information

With the cursor flashing on the word FUNCTION, press the. Section 1. <MODE> key

With the cursor flashing on the word FUNCTION, press the. Section 1. <MODE> key 1 USING THE TI-89 A Primer for TI-83 Users (Easy Calculus Summer Assignment) Come to school on the first day with your TI-89. We will start school by learning calculus, so this assignment will help you

More information

CS-201 Introduction to Programming with Java

CS-201 Introduction to Programming with Java CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture V: Mathematical Functions, Characters, and Strings Introduction How would you estimate

More information

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: ####

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: #### Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 Lab partners: Lab#1 Presentation of lab reports The first thing we do is to create page headers. In Word 2007 do the following:

More information

MATLAB Project: Getting Started with MATLAB

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

MATLAB Demo. Preliminaries and Getting Started with Matlab

MATLAB Demo. Preliminaries and Getting Started with Matlab Math 250C Sakai submission Matlab Demo 1 Created by G. M. Wilson, revised 12/23/2015 Revised 09/05/2016 Revised 01/07/2017 MATLAB Demo In this lab, we will learn how to use the basic features of Matlab

More information

INTRODUCTION TO MATLAB PROGRAMMING Lec 1.1: MATLAB Basics

INTRODUCTION TO MATLAB PROGRAMMING Lec 1.1: MATLAB Basics INTRODUCTION TO MATLAB PROGRAMMING Lec 1.1: MATLAB Basics Dr. Niket Kaisare Department of Chemical Engineering IIT Madras NPTEL Course: MATLAB Programming for Numerical Computations Week-1 About this Module

More information

Matlab = Matrix Laboratory. It is designed to be great at handling matrices.

Matlab = Matrix Laboratory. It is designed to be great at handling matrices. INTRODUCTION: Matlab = Matrix Laboratory. It is designed to be great at handling matrices. Matlab is a high-level language and interactive environment. You write simple ASCII text that is translated into

More information

MATLAB The first steps. Edited by Péter Vass

MATLAB The first steps. Edited by Péter Vass MATLAB The first steps Edited by Péter Vass MATLAB The name MATLAB is derived from the expression MATrix LABoratory. It is used for the identification of a software and a programming language. As a software,

More information

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial 1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the

More information

TI-89 graphing calculators are loaded with many useful features. With

TI-89 graphing calculators are loaded with many useful features. With In This Chapter Chapter 1 Coping with the Basics Turning the calculator on and off Using the keyboard Using the menus Setting the mode of the calculator Using the CATALOG TI-89 graphing calculators are

More information

Getting to Know Maple

Getting to Know Maple Maple Worksheets for rdinary Differential Equations Complimentary software to accompany the textbook: Differential Equations: Concepts, Methods, and Models (00-00 Edition) Leigh C. Becker Department of

More information

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

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some

More information

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial CSI31 Lecture 5 Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial 1 3.1 Numberic Data Types When computers were first developed, they were seen primarily as

More information

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c. MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab

More information

Activity: page 1/10 Introduction to Excel. Getting Started

Activity: page 1/10 Introduction to Excel. Getting Started Activity: page 1/10 Introduction to Excel Excel is a computer spreadsheet program. Spreadsheets are convenient to use for entering and analyzing data. Although Excel has many capabilities for analyzing

More information

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed MATLAB Constants, Variables & Expression Introduction MATLAB can be used as a powerful programming language. It do have IF, WHILE, FOR lops similar to other programming languages. It has its own vocabulary

More information

Python Programming Exercises 1

Python Programming Exercises 1 Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them

More information

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017 Numerical Modelling in Fortran: day 2 Paul Tackley, 2017 Goals for today Review main points in online materials you read for homework http://www.cs.mtu.edu/%7eshene/courses/cs201/notes/intro.html More

More information

Computational Physics

Computational Physics Computational Physics Python Programming Basics Prof. Paul Eugenio Department of Physics Florida State University Jan 17, 2019 http://hadron.physics.fsu.edu/~eugenio/comphy/ Announcements Exercise 0 due

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Department of Computer Science and Information Systems Tingting Han (afternoon), Steve Maybank (evening) tingting@dcs.bbk.ac.uk sjmaybank@dcs.bbk.ac.uk Autumn 2017 Week 4: More

More information

Lecture 1: What is MATLAB?

Lecture 1: What is MATLAB? Lecture 1: What is MATLAB? Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1. MATLAB MATLAB (MATrix LABoratory) is a numerical

More information

MAT137 Calculus! Lecture 31

MAT137 Calculus! Lecture 31 MAT137 Calculus! Lecture 31 Today: Next: Integration Methods: Integration Methods: Trig. Functions (v. 9.10-9.12) Rational Functions Trig. Substitution (v. 9.13-9.15) (v. 9.16-9.17) Integration by Parts

More information

LAB 2: Linear Equations and Matrix Algebra. Preliminaries

LAB 2: Linear Equations and Matrix Algebra. Preliminaries Math 250C, Section C2 Hard copy submission Matlab # 2 1 Revised 07/13/2016 LAB 2: Linear Equations and Matrix Algebra In this lab you will use Matlab to study the following topics: Solving a system of

More information

C++ Support Classes (Data and Variables)

C++ Support Classes (Data and Variables) C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming

More information

ENGR 1181c Midterm Exam 2: Study Guide and Practice Problems

ENGR 1181c Midterm Exam 2: Study Guide and Practice Problems ENGR 1181c Midterm Exam 2: Study Guide and Practice Problems Disclaimer Problems seen in this study guide may resemble problems relating mainly to the pertinent homework assignments. Reading this study

More information

Objectives. Structure. Munster Programming Training

Objectives. Structure. Munster Programming Training 1 Munster Programming Training Objectives 1. To give a short and basic introduction to computer programming, web design, web animation and video production. 2. To foster interest in computers by encouraging

More information

190 Lecture 14 Arrays, allocation

190 Lecture 14 Arrays, allocation 190 Lecture 14 Arrays, allocation Reading assignment: chapters. 8, 9, 10, 11, VECTORS AND ARRAYS real::v(4) means v = v 1, v 2, v 3, v 4 real::v(1:4)same thing v = v 1, v 2, v 3, v 4 real::v(0:3)means

More information

WeBWorK PREP Webconference. Paul Pearson Fort Lewis College May 26, 2011

WeBWorK PREP Webconference. Paul Pearson Fort Lewis College May 26, 2011 WeBWorK PREP Webconference Paul Pearson Fort Lewis College May 26, 2011 A. Preliminaries about Perl 1. Webwork is built from Perl advantages: scripted language, popular, fast, etc. disadvantages: sometimes

More information

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types Introduction to Computer Programming in Python Dr William C Bulko Data Types 2017 What is a data type? A data type is the kind of value represented by a constant or stored by a variable So far, you have

More information

Our Strategy for Learning Fortran 90

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

Calculus II - Math 1220 Mathematica Commands: From Basics To Calculus II - Version 11 c

Calculus II - Math 1220 Mathematica Commands: From Basics To Calculus II - Version 11 c Calculus II - Math 1220 Mathematica Commands: From Basics To Calculus II - Version 11 c Edit your document (remove extras and errors, ensure the rest works correctly) and turn-in your print-out. If needed,

More information

Intrinsic Functions Outline

Intrinsic Functions Outline Intrinsic Functions Outline 1. Intrinsic Functions Outline 2. Functions in Mathematics 3. Functions in Fortran 90 4. A Quick Look at ABS 5. Intrinsic Functions in Fortran 90 6. Math: Domain Range 7. Programming:

More information

2. INTRODUCTORY EXCEL

2. INTRODUCTORY EXCEL CS130 - Introductory Excel 1 2. INTRODUCTORY EXCEL Fall 2017 CS130 - Introductory Excel 2 Introduction to Excel What is Microsoft Excel? What can we do with Excel? CS130 - Introductory Excel 3 Launch Excel

More information

A very brief Matlab introduction

A very brief Matlab introduction A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading

More information

AP Calculus Summer Review Packet

AP Calculus Summer Review Packet AP Calculus Summer Review Packet Name: Date began: Completed: **A Formula Sheet has been stapled to the back for your convenience!** Email anytime with questions: danna.seigle@henry.k1.ga.us Complex Fractions

More information

A General Introduction to Matlab

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

Getting Started With Excel

Getting Started With Excel Chapter 1 Getting Started With Excel This chapter will familiarize you with various basic features of Excel. Specific features which you need to solve a problem will be introduced as the need arises. When

More information

Mathworks (company that releases Matlab ) documentation website is:

Mathworks (company that releases Matlab ) documentation website is: 1 Getting Started The Mathematics Behind Biological Invasions Introduction to Matlab in UNIX Christina Cobbold and Tomas de Camino Beck as modified for UNIX by Fred Adler Logging in: This is what you do

More information

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window. EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses

More information

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information Algebra 2 Semester 2 Final Exam Study Outline 2013 Semester 2 Final Exam Study Tips and Information The final exam is CUMULATIVE and will include all concepts taught from Chapter 1 through Chapter 13.

More information

Pre-Calculus Summer Assignment

Pre-Calculus Summer Assignment Name: Pre-Calculus Summer Assignment Due Date: The beginning of class on September 8, 017. The purpose of this assignment is to have you practice the mathematical skills necessary to be successful in Pre-Calculus.

More information