MATLAB M-FILES AND PROGRAMMING

Size: px
Start display at page:

Download "MATLAB M-FILES AND PROGRAMMING"

Transcription

1 Chapter 1 MATLAB M-FILES AND PROGRAMMING 1.1 Introduction The course is based around the use of the internationally recognised software tool MATLAB. There is a comprehensive on-line help with the MATLAB software, there are numerous books and online tutorials written on MATLAB programming, searching the UWO library database is a good starting point. MATLAB ˆ - in its simplest form is a basic scientific calculator; in its sophisticated form it is a scientific, graphing, programmable, matrix algebra calculator with a set of toolboxes for advanced problem solving. ˆ The array of modern utilities involving state of the art algorithms make MATLAB a very powerful scientific computational tool. ˆ However MATLAB is an interpreted language and can execute more slowly than compiled languages. Just bear this is mind for large computations. 1.2 Revision of MATLAB Basics - NOT Lectured Invoke MATLAB by clicking on the MATLAB icon. You are in the MATLAB Command Window - which is part of the MATLAB Desktop. Commands can be typed after the >> prompt. ˆ The MATLAB Environment The MATLAB desktop comes with a number of windows and tools which describe your current MATLAB environment. The main window is the Command Window. The other two windows are the Command History Window which displays the sequence of commands and outputs that have appeared in the Command Window, and the Launch Pad/Workspace window. MATLAB Commands are typed after the >> prompt in the Command Window. 1

2 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 2 ˆ HELP features. The Windows version of MATLAB contains a complete HELP browser - see Section as well as command line HELP utilities. Try typing help; help help; help who; help ls in the Command Window. The lookfor command is also available on the command line. This command will return all occurrences of a word. Try typing help lookfor and lookfor tan. ˆ ARITHMETIC OPERATIONS MATLAB as a desktop calculator. (Note anything after a is a MATLAB comment.) >> 7+9 ans is a special MATLAB value ans = 16 >> 7*9 ans = 63 >> 7^2 ans = 49 You must follow the laws of the algebra of real numbers with regard to precedence of operations, eg (power), */, then +, with anything in parentheses (brackets () ) being evaluated first. >> 53+4 ans = 57 >> 5*(3+4) Calculate (3 + 4) first ans = 35 ˆ LAST-LINE EDITING You have typed: >> 5*( /9)/4.6 ans = However you meant to type 2.9 instead of 2/9 MATLAB has a simple line-editor process - (uparrow) key recalls previous calculations; then use right and left arrow keys to shift on the line; use the Backspace key to delete; and insert text as required. The down arrow key scrolls through the previous commands. ˆ MATLAB ERROR MESSAGES Tutors are always being asked what is wrong with my MATLAB?.

3 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 3 Recognizing incorrect code is a matter of practice and commonsense. At this stage we will be mainly concerned with syntax errors - that is incorrect use of MATLAB statements. MATLAB will give an error message where possible and you should make sure you read this carefully. However sometimes the message is not at all clear and may be the result of a progression of errors. As a simple example: >> 52+*7??? 52+*7 Error : Unexpected MATLAB operator. Note that the place where MATLAB believes the error to have occurred is marked. MATLAB is trying to say that it really expected a value of some kind - say a number instead of two arithmetic operators. However would actually be executed since it is assumed you meant 52 (+7) with the multiplication being performed first. In this case missing out the value would go undetected and hence cause a computational error. ˆ BUILT-IN FUNCTIONS Just as a scientific calculator has keys to invoke special functions such as square-root, exponential, logarithms; trig functions etc, MATLAB also has built-in functions. Mathematical MATLAB 6.5 >> sqrt(6.5) e 6.5 >> exp(6.5) ln 6.5 >> log(6.5) natural logarithm (base e) log 6.5 >> log10(6.5) common logarithm (base 10) sin(6.5) >> sin(6.5) NOTE: arguments for trigonometric functions are taken to be in RADIANS Try these: Verify log(10000) is 4 Verify ln( ) = ln(3.2) + ln(8.5) Verify 10 log 10 (100) = 100 Verify e ln(3.5) = 3.5 ˆ BUILT-IN VALUES MATLAB has various built-in standard values which are obtained using common terminology. You have already come across the ans special value which contains the result of a a command line operation. The value for π is represented by the name pi in MATLAB. Type >> pi to obtain a value. Thus sin(60 ) is expressed as >> sin(60*pi/180) Since MATLAB essentially works in complex arithmetic, the names i or j are associated with the standard mathematical complex number i = 1 Type >> 1+2i to obtain a value. Note 1+2j will give the same result. Note that these names may be assigned other values - it is a good habit to get into with MATLAB to avoid using these MATLAB names for other values. ˆ MODES or FORMATS for DISPLAYING OUTPUT DATA Type Then type >> help format

4 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 4 >> format long >> pi >> then type in >> format short >> pi Compare the output for each case. The default is format short ˆ MATLAB VARIABLES MATLAB allows you to assign names to numeric values. That is we can use variables So far we have the built-in MATLAB variable ans >> 3*9 ans = 27 >> 4*6 ans = 24 However it is clear that the value of ans will change for each calculation. So let us assign names: >> a =3*9 a = 27 >> b =4*6 b = 24 >> a*b ans = 648 >> c=a* b c = 648 However if you type A instead of a you will told A is undefined. NOTE: This is because in MATLAB, names are CASE SENSITIVE Also do NOT use the same names as MATLAB does for its functions etc. ˆ MATLAB WORKSPACE The values you are working with are associated with variable names that tag memory locations. By typing the command who you will obtain a list of such variables; whilst the command whos gives a detailed list. This information is referred to as your workspace. In order to clear your workspace the command clear can be used.

5 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 5 ˆ REDUCING THE AMOUNT OF OUTPUT - SUPPRESSING OUTPUT You may have noticed that you get every value echoed. Try >> x0=10, v0=15, a=-9.81, t=5 This can be a real nuisance and so MATLAB has a way of suppressing this output. Simply follow a variable name, expression, etc by a semi-colon ; (semi-colon) Try >> x0=10; v0=15; a=-9.81; t=5; (don t forget to use the arrow keys to roll back the previous line and edit it) If you want the value, simply type the variable name: ˆ LONG LINES >> t If a line is too long, it may be continued by using three periods... For example for p = Aj L4 V + B V 3 L 2 1+j we might type: >> P = A*j*L^4 /V +... B*(V^3* L ^2)/(1+ j) ˆ COMMON MISTAKES Note that the way we write mathematical expressions often implies the existence of arithmetic operations without the symbols being used explicitly. In the expression for p above, multiplication is implied and must be explicitly written in MATLAB (or any programming language for that matter). This is a common cause of errors. Also note that it is wise to use brackets (parentheses) to ensure calculations are carried out correctly, even if the original expression does not use them - often they are implied by the typesetting. For example in the expression MATLAB should be written The code θ 2π >> theta/(2*pi) it should be realised that the factor 2π is the divisor and thus the >> theta/2*pi is equivalent to θ 2π which is clearly not what was intended. This is another common cause of errors. ˆ OTHER DATA TYPES In common with many programming languages MATLAB has a range of data types. The most common ones are double and char. double refers to numeric values including those in arrays (see later) whilst char refers to string values. For example we could set the variable str to a string of characters as follows: >> str = ' This is a message for you ' str = This is a message for you ˆ OUTPUTTING INFORMATION If you wish for just the message in the string variable str to be output then supress output in the usual way and use the disp function to display the string. >> str = ' This is a message for you '; disp ( str ) This is a message for you

6 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 6 The disp command can be used to display the values of numeric variables. So far we have seen that output can be obtained by simply not putting a semi-colon (;) after any expressions or assignment statements; by typing a variable name, or by use of the disp command. In order to produce readable output in a well presented layout, we need to use a variety of methods for output. The standard style of output in most languages is a form of print command - namely fprintf in MATLAB (very similar to the C language). Unfortunately in all languages one runs into the problem of formatting which is the cause of much grief. We will make use of the fprintf command throughout the course so that by the time we have finished you should be an expert. 1.3 MATLAB Files In this course it will be necessary to work with several MATLAB file structures. One such file is the MATLAB DIARY file which is simply a record of all the output that occurs in the command window when the DIARY session is activated. Other files are the script and function M-files. These files will involve using the MATLAB editor which is part of the MATLAB environment. ˆ USING THE DIARY FILE FEATURE MATLAB has the facility for you to save everything you type and everything that is output in the Command Window. This can be accomplished by using the diary command. Type >> help diary You can invoke or turn diary on by the command >> diary filename Here filename is any name you care to use (it is a good idea to distinguish these files for easy reference - I suggest a.txt extension, for example lab1results.txt You close your diary file, - turn off the diary process by using >> diary off. Since computer software systems do not like files being open in different places. It pays to close the diary file before trying to edit the file. The file produced is an ASCII text file and can be edited with the MATLAB editor. ˆ MATLAB M-files MATLAB is designed to work with specially named files called M-files. These files contain sets of MATLAB instructions and are identified by the extension.m M-files are ASCII text files - that is they consist of lines of text, numerical values, special symbols that form a set of MATLAB commands. In this course we will consider two types of M-files - the basic SCRIPT M-file and the specialised FUNCTION M-file. MATLAB will look for files with a.m extension - the so-called M-files and execute them if you type the name as a command. Thus if mighty.m is an M-file in your directory, >> mighty will cause MATLAB to look for a file called mighty.m and execute the commands in that file. Note that the extension is NOT included when invoking your M-file. You can list your M-file by typing in the command >> type mighty In order to construct an M-file you will need to use an editor. MATLAB has an accompanying editor, to invoke the editor either click on the new script icon in the toolbar or through the File New Script or from the command window by typing >> edit. M-file style

7 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 7 I tend to keep my variable names short to avoid excessive typing and over-verbose code that becomes difficult to read in terms of a mass of characters which obscure the flow and intention of the code. There is optimal level in my opinion. Example of a MATLAB script M-file: EXAMPLE 1.3.1: Consider the volume V of liquid in a spherical tank of radius r as given by the formula V = πh2 (3r h) 3 where h is the depth of the liquid. Write an M-file to calculate V for the values r = 1m, h = 0.7m. The procedure for this is : 1. Set up the mathematical model/equation for the problem - given in this case. 2. Design your algorithm (straight forward in this case). 3. Use the editor to type in your MATLAB statements - save as say myliquid.m 4. Try executing your M-file in MATLAB by typing >> myliquid 5. If there is an error, or you wish to modify what you have done - simply edit the M-file and execute it again. The editor can be invoked by clicking on File at the top left hand corner of the MATLAB window, and selecting New and then M-File from the drop-down menu. An editor window will then appear and the commands can be typed in just as you would in the command window. Note that you are supplying a logical sequence of instructions that are going to be executed one after the other in sequence and hence the order is important. For example, assign values to variables before using those variables in expressions. Thus type into the editor screen the following and then Save As the file myliquid.m the following is a MATLAB script M-file listing MATLAB Script file : myliquid. m Purpose : To calculate the volume of liquid in a spherical tank of radius r. Define variables : Input : r -- radius of the tank in metres h -- depth of the fluid in metres Output : V -- volume of the fluid in cubic metres Output a title for the problem output data disp ( '### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### ') Assign values to r and h r =1; h =0.7; Output input values The 5.1 f is a format for the output - occupy 5 positions with one decimal place, in fixed point mode fprintf ( ' The tank has radius r =5.1 f metres \ n ',r) fprintf ( ' The depth of the liquid is h =5.1 f metres \ n ',h) Calculate the volume of liquid

8 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 8 V=pi*h ^2*(3* r-h )/3; Output the Volume fprintf ( ' The volume of liquid is V =10.2 f cubic metres \ n ',V) Terminate the output with a statement disp ( '##### END OF VOLUME CALCULATION ##### ') End of script myliquid. m end of MATLAB script M-file listing Having saved the commands typed into the editor in the file myliquid.m you are now in a position to run or execute the file. To do this: Type >> myliquid to run (execute) the M-file in the command window. MATLAB will look for a file called myliquid.m (using the MATLAB path which will include your current directory as first choice) and proceed to execute the commands in the file. In order to illustrate a typical final run (that is when all the bugs have been sorted out) consider the following code and output that would appear in the command window and, in this case, be collected in the diary file, myliquid.txt: the following is MATLAB command window contents >> diary myliquid. txt Turn a diary file on - using filename myliquid. txt >> type myliquid List the M- file - >> produces as output the commands in myliquid. m MATLAB Script file : myliquid. m Purpose : To calculate the volume of liquid in a spherical tank of radius r. Define variables : Input : r -- radius of the tank in metres h -- depth of the fluid in metres Output : V -- volume of the fluid in cubic metres disp ( '### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### ') Assign values to r and h r =1; h =0.7; Output input values fprintf ( ' The tank has radius r =5.1 f metres \ n ',r) fprintf ( ' The depth of the liquid is h =5.1 f metres \ n ',h) Calculate the volume of liquid V=pi*h ^2*(3* r-h )/3; Output the Volume fprintf ( ' The volume of liquid is V =10.2 f cubic metres \ n ',V) disp ( '##### END OF CALCULATION ##### ') End of script myliquid. m >> myliquid Run ( execute ) the M- file - produces the output from the M- file

9 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 9 ### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### The tank has radius r= 1.0 metres The depth of the liquid is h= 0.7 metres The volume of liquid is V= 1.18 cubic metres ##### END OF CALCULATION ##### >> diary off Turn the diary file off - close the file end of MATLAB command window contents So the diary file now contains all the details output in the command window including a listing of the commands in the M-file and the output produced by executing the M-file. You can edit the diary file to remove any spurious unwanted output accidently produced for example. The file myliquid.txt could then be sent to the printer to obtain hard-copy. 1.4 Examples of Structures in Programming - While Loops and Branching EXAMPLE 1.4.1: Reconsider the problem and code of EXAMPLE only this time we will set up a structure for handling a number of different values for h which will be entered on request from the keyboard. Basically we shall use a while statement to achieve our purpose. If we describe what we want to do in plain English, using a pseudo-code notation, then we should be able to write the MATLAB code. 1. Input first h value 2. Calculate the volume of liquid 3. Input another value of h and repeat step 2. So we have a loop where we just keep repeating commands. Clearly the process will stop when we run out of h values. To program this we can ask the question: is there a value for h? To implement this test we can use a MATLAB function called isempty which simply checks on the state of h. Basically did you enter a value or simply hit the enter key. So we can continue the looping process while h is not empty - written as while isempty(h) We will also present the output in a table and will need to set up table headers. Thus the code now becomes:

10 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence the following is a MATLAB script M-file listing MATLAB Script file : myliquid2. m Purpose : To calculate the volume of liquid in a spherical tank of radius r for values of the depth of fluid, h. Define variables : Input : r -- radius of the tank in metres h -- depth of the fluid in metres Output : V -- volume of the fluid in cubic metres Output a title for the problem output data disp ( '### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### ') Assign a value to r r =1; Output input values The 5.1 f is a format for the output - occupy 5 positions with one decimal place, in fixed point mode fprintf ( ' The tank has radius r =5.1 f metres \ n ',r) Set up headers for the table of output of h and V disp ( ' =================================================== ') fprintf ( ' Depth of liquid Volume of liquid \ n ') fprintf ( ' h metres V cubic metres \ n ') disp ( ' =================================================== ') Input the first value of h h= input ( ' Input a value for the depth h ( hit enter to stop ): '); Use a while loop to repeat calculation of volume for various h values Terminate while loop if h has no value - that is continue to loop while h is not empty while ~ isempty ( h) fprintf ( ' The depth of the liquid is h =5.1 f metres \ n ',h) Calculate the volume of liquid V=pi*h ^2*(3* r-h )/3; Output h and the corresponding Volume in a table fprintf ( '10.2 f 10.2 f \n ',h,v) Input another value for h ( hit enter to stop ) h= input ( ' Input a value for the depth h ( hit enter to stop ): '); end end of the range of the while loop Terminate the output with a statement disp ( '##### END OF VOLUME CALCULATION ##### ') End of script myliquid2. m end of MATLAB script M-file listing

11 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 11 EXAMPLE 1.4.2: Typical output is: the following is output from a MATLAB script M-file >> myliquid2 Execute the M- file myliquid2. m - Output appears below ### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### The tank has radius r= 1.0 metres =================================================== Depth of liquid Volume of liquid h metres V cubic metres =================================================== Input a value for the depth h ( hit enter to stop ): Input a value for the depth h ( hit enter to stop ): Input a value for the depth h ( hit enter to stop ): ##### END OF VOLUME CALCULATION ##### end of output from a MATLAB script M-file This output is interspersed with input requests so let us modularize the algorithm so that we save the output values h and V as rows of an array and output that array. This means moving the output section to the end of the code to follow the lines produced by the input requests. Thus we have the array version of our program: the following is a MATLAB script M-file listing MATLAB Script file : myliquid2a. m Purpose : To calculate the volume of liquid in a spherical tank of radius r for values of the depth of fluid, h. Define variables : Input : r -- radius of the tank in metres h -- depth of the fluid in metres Output : V -- volume of the fluid in cubic metres Print a title for the problem output data disp ( '### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### ') Assign a value to r r =1; Initialize an array to null to hold the output of h and V out_table =[]; Input the first value of h h= input ( ' Input a value for the depth h ( hit enter to stop ): ');

12 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 12 Use a while loop to repeat calculation of volume for various h values Terminate while loop if h has no value - that is continue to loop while h is not empty while ~ isempty ( h) Calculate the volume of liquid V=pi*h ^2*(3* r-h )/3; Put h and the corresponding Volume in an array Add columns since fprintf statement will output column by column out_table =[ out_table [ h; V ]]; There are lots of variations for this but in this form out_table itself will look like a data set as presented in many texts Input another value for h ( hit enter to stop ) h= input ( ' Input a value for the depth h ( hit enter to stop ): '); end end of the range of the while loop OUTPUT SECTION Output input values skip 2 lines (\ n) fprintf ( '\n\n ****** OUTPUT FOR FLUID IN A SPHERICAL TANK ****** \n\n ') The 5.1 f is a format for the output - occupy 5 positions with one decimal place, in fixed point mode fprintf ( ' The tank has radius r =5.1 f metres \ n ',r) Set up headers for the table of output of h and V disp ( ' =================================================== ') fprintf ( ' Depth of liquid Volume of liquid \ n ') fprintf ( ' h metres V cubic metres \ n ') disp ( ' =================================================== ') fprintf ( '10.2 f 10.2 f \n ', out_table ) disp ( ' =================================================== ') Terminate the output with a statement disp ( '##### END OF VOLUME CALCULATION ##### ') End of script myliquid2a. m end of MATLAB script M-file listing The output would then look like: the following is output from a MATLAB script M-file >> myliquid2a Execute the M- file myliquid2a. m - Output appears below ### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### Input a value for the depth h ( hit enter to stop ): 0.2 Input a value for the depth h ( hit enter to stop ): 0.5 Input a value for the depth h ( hit enter to stop ): 0.8 Input a value for the depth h ( hit enter to stop ): 1 Input a value for the depth h ( hit enter to stop ): 1.3 Input a value for the depth h ( hit enter to stop ): 1.7 Input a value for the depth h ( hit enter to stop ): 1.9

13 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 13 Input a value for the depth h ( hit enter to stop ): ****** OUTPUT FOR FLUID IN A SPHERICAL TANK ****** The tank has radius r= 1.0 metres =================================================== Depth of liquid Volume of liquid h metres V cubic metres =================================================== =================================================== ##### END OF VOLUME CALCULATION ##### end of output from a MATLAB script M-file NOTE: At this stage it should be mentioned again that it is a good idea to type clear all before running programs in order to ensure all variables are reset. EXAMPLE 1.4.3: Let us reconsider our problem again so that this time we check for say negative input values. For this we need a branching structure of the form: if <a test is true > [ execute this block ( A) of statements ] else [ execute this block ( B) of statements ] end Basically what is needed is that the calculation is performed if h 0 but if h is negative then we will print a message to that extent and ask for another value of h. Thus our program becomes: the following is a MATLAB script M-file MATLAB Script file : myliquid3. m Purpose : To calculate the volume of liquid in a spherical tank of radius r for values of the depth of fluid, h. Include a test for a negative h value Define variables : Input : r -- radius of the tank in metres h -- depth of the fluid in metres Output : V -- volume of the fluid in cubic metres Output a title for the problem output data

14 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 14 disp ( '### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### ') Assign a value to r r =1; Initialize an array to null to hold the output of h and V out_table =[]; Input the first value of h h= input ( ' Input a value for the depth h ( hit enter to stop ): '); Use a while loop to repeat calculation of volume for various h values Terminate while loop if h has no value - that is continue to loop while h is not empty while ~ isempty ( h) Test to see if h <0 and branch accordingly if h >= 0 These are the block A statements if h is ok carry on with calculation Calculate the volume of liquid V=pi*h ^2*(3* r-h )/3; Put h and the corresponding Volume in an array Add columns since fprintf statement will output column by column out_table =[ out_table [ h; V ]]; There are lots of variations for this but in this form out_table will look like a data set as presented in many texts end of block A statements else These are the block B statements, executed only if h <0 else if h is negative, output a message and get another h value these are fprintf ([ '\ n!! DATA ERROR : a negative h value was entered, ',... 'get another h value!! \n ']) end of block B statements end Whatever the outcome : Input another value for h ( hit enter to stop ) h= input ( ' Input a value for the depth h ( hit enter to stop ): '); end end of the range of the while loop OUTPUT SECTION Output input values skip 2 lines (\ n) fprintf ( '\n\n ****** OUTPUT FOR FLUID IN A SPHERICAL TANK ****** \n\n ') The 5.1 f is a format for the output - occupy 5 positions with one decimal place, in fixed point mode fprintf ( ' The tank has radius r =5.1 f metres \ n ',r) Set up headers for the table of output of h and V disp ( ' =================================================== ') fprintf ( ' Depth of liquid Volume of liquid \ n ') fprintf ( ' h metres V cubic metres \ n ') disp ( ' =================================================== ') fprintf ( '10.2 f 10.2 f \n ', out_table ) disp ( ' =================================================== ') Terminate the output with a statement disp ( '##### END OF VOLUME CALCULATION ##### ') End of script myliquid3. m

15 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence end of MATLAB script M-file listing the following is output from a MATLAB script M-file >> myliquid3 Execute the M- file myliquid3. m - Output appears below ### CALCULATION OF THE VOLUME OF LIQUID IN A SPHERICAL TANK ### Input a value for the depth h ( hit enter to stop ): 0.3 Input a value for the depth h ( hit enter to stop ): 0.5 Input a value for the depth h ( hit enter to stop ): -1!! DATA ERROR : a negative h value was entered, get another h value!! Input a value for the depth h ( hit enter to stop ): 1 Input a value for the depth h ( hit enter to stop ): ****** OUTPUT FOR FLUID IN A SPHERICAL TANK ****** The tank has radius r= 1.0 metres =================================================== Depth of liquid Volume of liquid h metres V cubic metres =================================================== =================================================== ##### END OF VOLUME CALCULATION ##### end of output from a MATLAB script M-file Examples of Structures in Programming - For Loops - Counting or Stepping a Proscribed Number of Times The other type of loop which I use to do what it was intended for - repeat a process a set number of times - is the for loop. In numerical work we often have need to step from one point to another, or to iterate a process a number of times. EXAMPLE 1.5.1: Constructing an Iterative Process Consider the following problem which affects most of us at some time: Suppose you borrow $10,000 and are told that if you make repayments at a certain rate of $R per month you will have repaid the debt in N months. The question is whether you are indeed borrowing the money at the quoted interest rate say 11.5.

16 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 16 The first thing we shall do is to set up a mathematical model representing the problem. Mathematical Model Let P be the amount borrowed. let the rate of interest to be determined be r per annum. Let A k be the amount after the kth time interval (months). Then the amount owing at the end of the kth time interval, A k, is obtained from the amount owing at the end of the previous time interval, plus the interest, less the repayment. In mathematical terms this is simply: A k = A k 1 + A k 1 r 1200 R The interest rate needs to be expressed as a decimal and per month hence the factor Thus we have A k A k 1 (1 + r ) = R, k = 1(1)N 1200 This is the model definition which is a difference equation (a discrete version of a differential equation) which can be solved in much the same way as you solved differential equations in your mathematics courses. This is a first order linear equation with solution A k = C(1 + r 1200 )k R, k = 0(1)N r where C is an arbitrary constant. Now apply the known conditions: ˆ when k = 0, A 0 = P, so P = C R r Thus C = P 1200R. r ˆ when k = N, A N = 0, so that we have 0 = (P 1200R )(1 + r r 1200 )N R r Introduce a new non-dimensional variable x = Then we have: r 1200 (in this case the new variable x is not in percentages). 0 = (P R x )(1 + x)n + R x We have created the equation to be solved for the problem. We need a SOLVER process for this equation. The equation is a nonlinear equation in the unknown x To solve it let us take a simplistic approach and ignore for the moment the (1 + x) N term as involving x so we can solve the equation for x in the other terms as:

17 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 17 x = R((1 + x)n 1) P (1 + x) N Now if we had a value for x, an initial guess say, we could use it to evaluate the righthand-side which would give us a new value for x. This process could be repeated until, hopefully, the value of x does not change. This would mean the process has converged. This process is referred to as an ITERATIVE process and is a key process in numerical mathematics. The next question should be: How do we obtain an initial guess? Often the problem suggests a procedure. In this case since x is small we could approximate (1 + x) N by the first TWO terms in the series expansion: (1 + x) N 1 + Nx This a linear approximation and using this in the equation gives x R((1 + Nx) 1) P (1 + x) N or (1 + x) N RN P This equation is precisely what you would get if you took no account of repayments until the end so that you had compound interest on P over N months so that the total to be repaid would be P (1 + x) N = RN Putting the given values in gives x = and r = 1200x = 7.15 Now we know that this is rather low since the quoted rate was 11.5 giving x = so let us simply double our simple compound interest value as our initial value for x. Then we have the iterative process: x k = R((1 + x k 1) N 1) P (1 + x k 1 ) N k = 1, 2, 3,... where x 0 = 2c, c = ( RN P ) 1 N 1 EXAMPLE 1.5.2: Programming an Iterative Process The iterative process can be coded in MATLAB as follows. Most of the code is comments and output statements which is typical of most computer programs in any language the following is a MATLAB script M-file Script file myinterest. m Purpose : To calculate the true interest rate on a loan of $P given the monthly repayments and the number of repayments Problem variables : Input variables : P - the loan amount ( pricipal ) R - the monthly repayment N - the number of months q - the quoted interest rate per annum Output variables : r - the true interest rate per annum Internal variables : x - the nondimensional monthly rate c - the rate from simple compound formula Iteration variables

18 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 18 maxits - maximum number of iterations permitted k -- iteration counter Output a title for the problem output data disp ( '### CALCULATION OF THE TRUE RATE OF INTEREST ON A LOAN ### ') Input the data values P= input ( ' Input a value for the principal of the loan : '); N= input ( ' Input a value for the number of months of the loan : '); R= input ( ' Input a value for the monthly repayments on the loan : '); q= input ( ' Input a value for the quoted annual interest rate for the loan : '); Ouput the data values : disp ( ' ========================================================================== ') fprintf ( '\ nthe principal of the loan is $ 8.2 f borrowed over 4.0 f months \ n ',P, N) fprintf ( ' The monthly repayments are $ 6.2 f \ n ',R) fprintf ( 'on a quoted interest rate of 5.2 f per annum \ n ',q) Set up a maximum number of iterations in case the iterative process takes too long maxits =20; Calculate initial value for the interest variable x c=(n*r/p )^(1/ N) -1; x =2* c; r =1200* x; k =0; set iteration counter k=0 for output purposes output headers for the table of values fprintf ( '\n\n k x r \n ') disp ( ' ======================================================= ') output initial values fprintf ( ' 5.0 f 10.4 f 10.2 f \n ',k,x,r) The iterative loop uses a for loop to simply count through the number of iterations - an increment of 1 is the default for k =1: maxits xn =(1+ x)^n; use an intermediate variable to do this once use the iterative formula to generate a new x value x=r*(xn -1)/( P*xN ); calculate the interest rate r =1200 x r =1200* x; output a table of values fprintf ( ' 5.0 f 10.4 f 10.2 f \n ',k,x,r) end end of range of the iterative for loop fprintf ( '\ n The true rate of interest is in fact 8.2 f \ n\ n ',r) Terminate the output with a statement disp ( '##### END OF INTEREST RATE CALCULATION ##### ') End of script myinterest. m end of MATLAB script M-file listing Execution of myinterest.m will produce the OUTPUT: the following is output from a MATLAB script M-file

19 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 19 >> myinterest Execute the M- file myinterest. m - Output appears below ### CALCULATION OF THE TRUE RATE OF INTEREST ON A LOAN ### Input a value for the principal of the loan : Input a value for the number of months of the loan : 36 Input a value for the monthly repayments on the loan : Input a value for the quoted annual interest rate for the loan : 11.5 ========================================================================== The principal of the loan is $ borrowed over 36 months The monthly repayments are $ on a quoted interest rate of per annum k x r ======================================================= The true rate of interest is in fact ##### END OF INTEREST RATE CALCULATION ##### end of output from a MATLAB script M-file As is often the case because of the manner in which the computations are carried out in financial institutions you find you are being overcharged. Worst case scenarios of double the quoted rate as exercised in many hire purchase schemes resulted in Government action a number of years ago to insist the true rate is quoted. However there have been a number of cases involving financial institutions in regard to this problem. Since all of us including engineers borrow money then it is worth knowing something about loans and interest. In order to organise the output in a more tractable tabular form (you could also leave out the formatting and use disp instead of fprintf, the following revised form of the interest code is given. Here the iteration values are stored in an array the following is a MATLAB script M-file

20 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 20 Script file myinterest_rev. m Purpose : To calculate the true interest rate on a loan of $P given the monthly repayments and the number of repayments Problem variables : Input variables : P - the loan amount ( pricipal ) R - the monthly repayment N - the number of months q - the quoted interest rate per annum Output variables : r - the true interest rate per annum Internal variables : x - the nondimensional monthly rate c - the rate from simple compound formula for initial x Iteration variables maxits - maximum number of iterations permitted k -- iteration counter clear all Clear Workspace clc Clear Screen Start Coding Screen title for the problem disp ( '### CALCULATION OF THE TRUE RATE OF INTEREST ON A LOAN ### ') Input the data values P= input ( ' Input a value for the principal of the loan : '); N= input ( ' Input a value for the number of months of the loan : '); R= input ( ' Input a value for the monthly repayments on the loan : '); q= input ( ' Input a value for the quoted annual interest rate for the loan : '); CORE Set up a maximum number of iterations in case the iterative process takes too long maxits =20; Calculate initial value for the interest variable x c=(n*r/p )^(1/ N) -1; x =2* c; r =1200* x; res (1,:)=[0 x r]; Store initial values in result matrix row1 contains the initial values The iterative loop uses a for loop to simply count through the number of iterations - an increment of 1 is the default for k =1: maxits xn =(1+ x)^n; use an intermediate variable to do this once use the iterative formula to generate a new x value x=r*(xn -1)/( P*xN ); calculate the interest rate r =1200 x r =1200* x; store solution in result matrix - row by row - start from row2 res (k +1,:)=[ k x r]; end end of range of the iterative for loop

21 AM Course Support Notes September 27, Bob Broughton & Piers Lawrence 21 Output the data values : clc Clear input screen Output title for the problem disp ( '### CALCULATION OF THE TRUE RATE OF INTEREST ON A LOAN ### ') fprintf ( '\ nthe principal of the loan is $ 8.2 f borrowed over 4.0 f months \ n ',P, N) fprintf ( ' The monthly repayments are $ 6.2 f \ n ',R) fprintf ( 'on a quoted interest rate of 5.2 f per annum \ n ',q) OUTPUT TABLE OF ITERATION VALUES output headers for the table of values fprintf ( '\n k x r \n ') disp ( ' ======================================================= ') output table - note MATLAB prints by column from an array, so transpose the array to obtain the row by row table. fprintf ( ' 5.0 f 10.4 f 10.2 f \n ',res ') output true interest rate fprintf ( '\ n The true rate of interest is in fact 8.2 f \ n\ n ',r) Terminate the output with a statement disp ( '##### END OF INTEREST RATE CALCULATION ##### ') End of script myinterest_rev. m end of output from a MATLAB script M-file QUESTIONS arising from the calculation might be: ˆ Can we stop the process sooner if it is clear convergence has taken place? For example in this case could we jump out iteration 15? - Answer yes by using the relative error test. ˆ What happens if we don t get convergence? How do we direct the program to deal with convergence and non-convergence?

MATLAB Programming. Problem 1: Sequential

MATLAB Programming. Problem 1: Sequential Division of Engineering Fundamentals, Copyright 1999 by J.C. Malzahn Kampe 1 / 21 MATLAB Programming When we use the phrase computer solution, it should be understood that a computer will only follow directions;

More information

Introduction. Chapter 1

Introduction. Chapter 1 Chapter 1 Introduction MATLAB (Matrix laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB is especially designed for matrix computations:

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. SSRL@American.edu Course Objective This course provides

More information

MATLAB Basics MATLAB numbers and numeric formats

MATLAB Basics MATLAB numbers and numeric formats MATLAB Basics MATLAB numbers and numeric formats All numerical variables are stored in MATLAB in double precision floating-point form. (In fact it is possible to force some variables to be of other types

More information

Welcome to GAMS 1. Jesper Jensen TECA TRAINING ApS jensen@tecatraining.dk. This version: September 2006

Welcome to GAMS 1. Jesper Jensen TECA TRAINING ApS jensen@tecatraining.dk. This version: September 2006 Welcome to GAMS 1 Jesper Jensen TECA TRAINING ApS jensen@tecatraining.dk This version: September 2006 1 This material is the copyrighted intellectual property of Jesper Jensen. Written permission must

More information

Beginner s Matlab Tutorial

Beginner s Matlab Tutorial Christopher Lum lum@u.washington.edu Introduction Beginner s Matlab Tutorial This document is designed to act as a tutorial for an individual who has had no prior experience with Matlab. For any questions

More information

Using Casio Graphics Calculators

Using Casio Graphics Calculators Using Casio Graphics Calculators (Some of this document is based on papers prepared by Donald Stover in January 2004.) This document summarizes calculation and programming operations with many contemporary

More information

Summary of important mathematical operations and formulas (from first tutorial):

Summary of important mathematical operations and formulas (from first tutorial): EXCEL Intermediate Tutorial Summary of important mathematical operations and formulas (from first tutorial): Operation Key Addition + Subtraction - Multiplication * Division / Exponential ^ To enter a

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Q&As: Microsoft Excel 2013: Chapter 2

Q&As: Microsoft Excel 2013: Chapter 2 Q&As: Microsoft Excel 2013: Chapter 2 In Step 5, why did the date that was entered change from 4/5/10 to 4/5/2010? When Excel recognizes that you entered a date in mm/dd/yy format, it automatically formats

More information

0 Introduction to Data Analysis Using an Excel Spreadsheet

0 Introduction to Data Analysis Using an Excel Spreadsheet Experiment 0 Introduction to Data Analysis Using an Excel Spreadsheet I. Purpose The purpose of this introductory lab is to teach you a few basic things about how to use an EXCEL 2010 spreadsheet to do

More information

Microsoft Excel Basics

Microsoft Excel Basics COMMUNITY TECHNICAL SUPPORT Microsoft Excel Basics Introduction to Excel Click on the program icon in Launcher or the Microsoft Office Shortcut Bar. A worksheet is a grid, made up of columns, which are

More information

Excel 2003 A Beginners Guide

Excel 2003 A Beginners Guide Excel 2003 A Beginners Guide Beginner Introduction The aim of this document is to introduce some basic techniques for using Excel to enter data, perform calculations and produce simple charts based on

More information

Introduction to Microsoft Excel 2010

Introduction to Microsoft Excel 2010 Introduction to Microsoft Excel 2010 Screen Elements Quick Access Toolbar The Ribbon Formula Bar Expand Formula Bar Button File Menu Vertical Scroll Worksheet Navigation Tabs Horizontal Scroll Bar Zoom

More information

Integrated Accounting System for Mac OS X

Integrated Accounting System for Mac OS X Integrated Accounting System for Mac OS X Program version: 6.3 110401 2011 HansaWorld Ireland Limited, Dublin, Ireland Preface Standard Accounts is a powerful accounting system for Mac OS X. Text in square

More information

Appendix: Tutorial Introduction to MATLAB

Appendix: Tutorial Introduction to MATLAB Resampling Stats in MATLAB 1 This document is an excerpt from Resampling Stats in MATLAB Daniel T. Kaplan Copyright (c) 1999 by Daniel T. Kaplan, All Rights Reserved This document differs from the published

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

MATLAB Functions. function [Out_1,Out_2,,Out_N] = function_name(in_1,in_2,,in_m)

MATLAB Functions. function [Out_1,Out_2,,Out_N] = function_name(in_1,in_2,,in_m) MATLAB Functions What is a MATLAB function? A MATLAB function is a MATLAB program that performs a sequence of operations specified in a text file (called an m-file because it must be saved with a file

More information

Euler s Method and Functions

Euler s Method and Functions Chapter 3 Euler s Method and Functions The simplest method for approximately solving a differential equation is Euler s method. One starts with a particular initial value problem of the form dx dt = f(t,

More information

14:440:127 Introduction to Computers for Engineers. Notes for Lecture 06

14:440:127 Introduction to Computers for Engineers. Notes for Lecture 06 14:440:127 Introduction to Computers for Engineers Notes for Lecture 06 Rutgers University, Spring 2010 Instructor- Blase E. Ur 1 Loop Examples 1.1 Example- Sum Primes Let s say we wanted to sum all 1,

More information

The KaleidaGraph Guide to Curve Fitting

The KaleidaGraph Guide to Curve Fitting The KaleidaGraph Guide to Curve Fitting Contents Chapter 1 Curve Fitting Overview 1.1 Purpose of Curve Fitting... 5 1.2 Types of Curve Fits... 5 Least Squares Curve Fits... 5 Nonlinear Curve Fits... 6

More information

Maple Quick Start. Introduction. Talking to Maple. Using [ENTER] 3 (2.1)

Maple Quick Start. Introduction. Talking to Maple. Using [ENTER] 3 (2.1) Introduction Maple Quick Start In this introductory course, you will become familiar with and comfortable in the Maple environment. You will learn how to use context menus, task assistants, and palettes

More information

FIRST STEPS WITH SCILAB

FIRST STEPS WITH SCILAB powered by FIRST STEPS WITH SCILAB The purpose of this tutorial is to get started using Scilab, by discovering the environment, the main features and some useful commands. Level This work is licensed under

More information

Introduction To Microsoft Office PowerPoint 2007. Bob Booth July 2008 AP-PPT5

Introduction To Microsoft Office PowerPoint 2007. Bob Booth July 2008 AP-PPT5 Introduction To Microsoft Office PowerPoint 2007. Bob Booth July 2008 AP-PPT5 University of Sheffield Contents 1. INTRODUCTION... 3 2. GETTING STARTED... 4 2.1 STARTING POWERPOINT... 4 3. THE USER INTERFACE...

More information

Home Loan Manager Pro 7.1

Home Loan Manager Pro 7.1 Home Money Manager www.homemoneymanager.com.au Home Loan Manager Pro 7.1 The Mortgage Checker and Planning Tool 05 November 2015 DOWNLOAD SOFTWARE Home Loan Manager Pro is available from www.homemoneymanager.com.au

More information

3.1. Solving linear equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

3.1. Solving linear equations. Introduction. Prerequisites. Learning Outcomes. Learning Style Solving linear equations 3.1 Introduction Many problems in engineering reduce to the solution of an equation or a set of equations. An equation is a type of mathematical expression which contains one or

More information

Integrated Invoicing and Debt Management System for Mac OS X

Integrated Invoicing and Debt Management System for Mac OS X Integrated Invoicing and Debt Management System for Mac OS X Program version: 6.3 110401 2011 HansaWorld Ireland Limited, Dublin, Ireland Preface Standard Invoicing is a powerful invoicing and debt management

More information

MATLAB Workshop 3 - Vectors in MATLAB

MATLAB Workshop 3 - Vectors in MATLAB MATLAB: Workshop - Vectors in MATLAB page 1 MATLAB Workshop - Vectors in MATLAB Objectives: Learn about vector properties in MATLAB, methods to create row and column vectors, mathematical functions with

More information

How to test and debug an ASP.NET application

How to test and debug an ASP.NET application Chapter 4 How to test and debug an ASP.NET application 113 4 How to test and debug an ASP.NET application If you ve done much programming, you know that testing and debugging are often the most difficult

More information

Introduction to the Hewlett-Packard (HP) 10BII Calculator and Review of Mortgage Finance Calculations

Introduction to the Hewlett-Packard (HP) 10BII Calculator and Review of Mortgage Finance Calculations Introduction to the Hewlett-Packard (HP) 10BII Calculator and Review of Mortgage Finance Calculations Real Estate Division Sauder School of Business University of British Columbia Introduction to the Hewlett-Packard

More information

Using Pivot Tables in Microsoft Excel 2003

Using Pivot Tables in Microsoft Excel 2003 Using Pivot Tables in Microsoft Excel 2003 Introduction A Pivot Table is the name Excel gives to what is more commonly known as a cross-tabulation table. Such tables can be one, two or three-dimensional

More information

Excel 2007 A Beginners Guide

Excel 2007 A Beginners Guide Excel 2007 A Beginners Guide Beginner Introduction The aim of this document is to introduce some basic techniques for using Excel to enter data, perform calculations and produce simple charts based on

More information

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0 European Computer Driving Licence Spreadsheet Software BCS ITQ Level 2 Using Microsoft Excel 2010 Syllabus Version 5.0 This training, which has been approved by BCS, The Chartered Institute for IT, includes

More information

Creating trouble-free numbering in Microsoft Word

Creating trouble-free numbering in Microsoft Word Creating trouble-free numbering in Microsoft Word This note shows you how to create trouble-free chapter, section and paragraph numbering, as well as bulleted and numbered lists that look the way you want

More information

Graphing Parabolas With Microsoft Excel

Graphing Parabolas With Microsoft Excel Graphing Parabolas With Microsoft Excel Mr. Clausen Algebra 2 California State Standard for Algebra 2 #10.0: Students graph quadratic functions and determine the maxima, minima, and zeros of the function.

More information

FX 115 MS Training guide. FX 115 MS Calculator. Applicable activities. Quick Reference Guide (inside the calculator cover)

FX 115 MS Training guide. FX 115 MS Calculator. Applicable activities. Quick Reference Guide (inside the calculator cover) Tools FX 115 MS Calculator Handouts Other materials Applicable activities Quick Reference Guide (inside the calculator cover) Key Points/ Overview Advanced scientific calculator Two line display VPAM to

More information

Windows XP Pro: Basics 1

Windows XP Pro: Basics 1 NORTHWEST MISSOURI STATE UNIVERSITY ONLINE USER S GUIDE 2004 Windows XP Pro: Basics 1 Getting on the Northwest Network Getting on the Northwest network is easy with a university-provided PC, which has

More information

Excel 2007 Basic knowledge

Excel 2007 Basic knowledge Ribbon menu The Ribbon menu system with tabs for various Excel commands. This Ribbon system replaces the traditional menus used with Excel 2003. Above the Ribbon in the upper-left corner is the Microsoft

More information

Lecture 2 Mathcad Basics

Lecture 2 Mathcad Basics Operators Lecture 2 Mathcad Basics + Addition, - Subtraction, * Multiplication, / Division, ^ Power ( ) Specify evaluation order Order of Operations ( ) ^ highest level, first priority * / next priority

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

Mailing lists process, creation and approval. Mailing lists process, creation and approval

Mailing lists process, creation and approval. Mailing lists process, creation and approval Mailing lists process, creation and approval Steps to creating your mailing list 1. Establish whether there is a generic mailing list that can be used (i.e. a list a sector or team use for every mailing)

More information

Equations, Inequalities & Partial Fractions

Equations, Inequalities & Partial Fractions Contents Equations, Inequalities & Partial Fractions.1 Solving Linear Equations 2.2 Solving Quadratic Equations 1. Solving Polynomial Equations 1.4 Solving Simultaneous Linear Equations 42.5 Solving Inequalities

More information

ASSIGNMENT 4 PREDICTIVE MODELING AND GAINS CHARTS

ASSIGNMENT 4 PREDICTIVE MODELING AND GAINS CHARTS DATABASE MARKETING Fall 2015, max 24 credits Dead line 15.10. ASSIGNMENT 4 PREDICTIVE MODELING AND GAINS CHARTS PART A Gains chart with excel Prepare a gains chart from the data in \\work\courses\e\27\e20100\ass4b.xls.

More information

2: Entering Data. Open SPSS and follow along as your read this description.

2: Entering Data. Open SPSS and follow along as your read this description. 2: Entering Data Objectives Understand the logic of data files Create data files and enter data Insert cases and variables Merge data files Read data into SPSS from other sources The Logic of Data Files

More information

EXTENDED FILE SYSTEM FOR F-SERIES PLC

EXTENDED FILE SYSTEM FOR F-SERIES PLC EXTENDED FILE SYSTEM FOR F-SERIES PLC Before you begin, please download a sample I-TRiLOGI program that will be referred to throughout this manual from our website: http://www.tri-plc.com/trilogi/extendedfilesystem.zip

More information

Intermediate PowerPoint

Intermediate PowerPoint Intermediate PowerPoint Charts and Templates By: Jim Waddell Last modified: January 2002 Topics to be covered: Creating Charts 2 Creating the chart. 2 Line Charts and Scatter Plots 4 Making a Line Chart.

More information

The CDS-ISIS Formatting Language Made Easy

The CDS-ISIS Formatting Language Made Easy The CDS-ISIS Formatting Language Made Easy Introduction The most complex aspect of CDS-ISIS is the formatting language, used to display, sort, print and download records. The formatting language is very

More information

Behavioral Health System

Behavioral Health System RESOURCE AND PATIENT MANAGEMENT SYSTEM Behavioral Health System (AMH) Version 4.0 Patch 6 Office of Information Technology Division of Information Technology Table of Contents 1.0 Objective #1: Introduction

More information

Model 288B Charge Plate Graphing Software Operators Guide

Model 288B Charge Plate Graphing Software Operators Guide Monroe Electronics, Inc. Model 288B Charge Plate Graphing Software Operators Guide P/N 0340175 288BGraph (80207) Software V2.01 100 Housel Ave PO Box 535 Lyndonville NY 14098 1-800-821-6001 585-765-2254

More information

Getting Started with Excel 2008. Table of Contents

Getting Started with Excel 2008. Table of Contents Table of Contents Elements of An Excel Document... 2 Resizing and Hiding Columns and Rows... 3 Using Panes to Create Spreadsheet Headers... 3 Using the AutoFill Command... 4 Using AutoFill for Sequences...

More information

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print In the simplest terms, grep (global regular expression print) will search input

More information

Bitrix Site Manager 4.1. User Guide

Bitrix Site Manager 4.1. User Guide Bitrix Site Manager 4.1 User Guide 2 Contents REGISTRATION AND AUTHORISATION...3 SITE SECTIONS...5 Creating a section...6 Changing the section properties...8 SITE PAGES...9 Creating a page...10 Editing

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

CD-ROM Appendix E: Matlab

CD-ROM Appendix E: Matlab CD-ROM Appendix E: Matlab Susan A. Fugett Matlab version 7 or 6.5 is a very powerful tool useful for many kinds of mathematical tasks. For the purposes of this text, however, Matlab 7 or 6.5 will be used

More information

EXCEL FINANCIAL USES

EXCEL FINANCIAL USES EXCEL FINANCIAL USES Table of Contents Page LESSON 1: FINANCIAL DOCUMENTS...1 Worksheet Design...1 Selecting a Template...2 Adding Data to a Template...3 Modifying Templates...3 Saving a New Workbook as

More information

Calculator Notes for the TI-89, TI-92 Plus, and Voyage 200

Calculator Notes for the TI-89, TI-92 Plus, and Voyage 200 CHAPTER 1 Note 1A Reentry Calculator Notes for the TI-89, TI-92 Plus, and Voyage 200 If you want to do further calculation on a result you ve just found, and that result is the first number in the expression

More information

Migrating to Excel 2010 from Excel 2003 - Excel - Microsoft Office 1 of 1

Migrating to Excel 2010 from Excel 2003 - Excel - Microsoft Office 1 of 1 Migrating to Excel 2010 - Excel - Microsoft Office 1 of 1 In This Guide Microsoft Excel 2010 looks very different, so we created this guide to help you minimize the learning curve. Read on to learn key

More information

Timeless Time and Expense Version 3.0. Copyright 1997-2009 MAG Softwrx, Inc.

Timeless Time and Expense Version 3.0. Copyright 1997-2009 MAG Softwrx, Inc. Timeless Time and Expense Version 3.0 Timeless Time and Expense All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including

More information

Desktop, Web and Mobile Testing Tutorials

Desktop, Web and Mobile Testing Tutorials Desktop, Web and Mobile Testing Tutorials * Windows and the Windows logo are trademarks of the Microsoft group of companies. 2 About the Tutorial With TestComplete, you can test applications of three major

More information

In this session, we will explain some of the basics of word processing. 1. Start Microsoft Word 11. Edit the Document cut & move

In this session, we will explain some of the basics of word processing. 1. Start Microsoft Word 11. Edit the Document cut & move WORD PROCESSING In this session, we will explain some of the basics of word processing. The following are the outlines: 1. Start Microsoft Word 11. Edit the Document cut & move 2. Describe the Word Screen

More information

Quick Tour of Mathcad and Examples

Quick Tour of Mathcad and Examples Fall 6 Quick Tour of Mathcad and Examples Mathcad provides a unique and powerful way to work with equations, numbers, tests and graphs. Features Arithmetic Functions Plot functions Define you own variables

More information

Welcome to Basic Math Skills!

Welcome to Basic Math Skills! Basic Math Skills Welcome to Basic Math Skills! Most students find the math sections to be the most difficult. Basic Math Skills was designed to give you a refresher on the basics of math. There are lots

More information

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2 Unix Shell Scripts Norman Matloff July 30, 2008 Contents 1 Introduction 1 2 Invoking Shell Scripts 2 2.1 Direct Interpretation....................................... 2 2.2 Indirect Interpretation......................................

More information

Sequential Program Execution

Sequential Program Execution Sequential Program Execution Quick Start Compile step once always g++ -o Realtor1 Realtor1.cpp mkdir labs cd labs Execute step mkdir 1 Realtor1 cd 1 cp../0/realtor.cpp Realtor1.cpp Submit step cp /samples/csc/155/labs/1/*.

More information

Computational Mathematics with Python

Computational Mathematics with Python Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40

More information

Adobe Conversion Settings in Word. Section 508: Why comply?

Adobe Conversion Settings in Word. Section 508: Why comply? It s the right thing to do: Adobe Conversion Settings in Word Section 508: Why comply? 11,400,000 people have visual conditions not correctible by glasses. 6,400,000 new cases of eye disease occur each

More information

Basic Use of the TI-84 Plus

Basic Use of the TI-84 Plus Basic Use of the TI-84 Plus Topics: Key Board Sections Key Functions Screen Contrast Numerical Calculations Order of Operations Built-In Templates MATH menu Scientific Notation The key VS the (-) Key Navigation

More information

Computational Mathematics with Python

Computational Mathematics with Python Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1

More information

Time Value of Money. 2014 Level I Quantitative Methods. IFT Notes for the CFA exam

Time Value of Money. 2014 Level I Quantitative Methods. IFT Notes for the CFA exam Time Value of Money 2014 Level I Quantitative Methods IFT Notes for the CFA exam Contents 1. Introduction...2 2. Interest Rates: Interpretation...2 3. The Future Value of a Single Cash Flow...4 4. The

More information

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning

More information

Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information.

Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information. Excel Tutorial Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information. Working with Data Entering and Formatting Data Before entering data

More information

3.2. Solving quadratic equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

3.2. Solving quadratic equations. Introduction. Prerequisites. Learning Outcomes. Learning Style Solving quadratic equations 3.2 Introduction A quadratic equation is one which can be written in the form ax 2 + bx + c = 0 where a, b and c are numbers and x is the unknown whose value(s) we wish to find.

More information

Excel Guide for Finite Mathematics and Applied Calculus

Excel Guide for Finite Mathematics and Applied Calculus Excel Guide for Finite Mathematics and Applied Calculus Revathi Narasimhan Kean University A technology guide to accompany Mathematical Applications, 6 th Edition Applied Calculus, 2 nd Edition Calculus:

More information

Preface of Excel Guide

Preface of Excel Guide Preface of Excel Guide The use of spreadsheets in a course designed primarily for business and social science majors can enhance the understanding of the underlying mathematical concepts. In addition,

More information

Basic Formulas in Excel. Why use cell names in formulas instead of actual numbers?

Basic Formulas in Excel. Why use cell names in formulas instead of actual numbers? Understanding formulas Basic Formulas in Excel Formulas are placed into cells whenever you want Excel to add, subtract, multiply, divide or do other mathematical calculations. The formula should be placed

More information

Lies My Calculator and Computer Told Me

Lies My Calculator and Computer Told Me Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing

More information

Getting started with the Stata

Getting started with the Stata Getting started with the Stata 1. Begin by going to a Columbia Computer Labs. 2. Getting started Your first Stata session. Begin by starting Stata on your computer. Using a PC: 1. Click on start menu 2.

More information

Using Parametric Equations in SolidWorks, Example 1

Using Parametric Equations in SolidWorks, Example 1 Using Parametric Equations in SolidWorks, Example 1 (Draft 4, 10/25/2006, SW 2006) Introduction In this example the goal is to place a solid roller on a solid wedge. Their relationship will be governed

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

14.1. Basic Concepts of Integration. Introduction. Prerequisites. Learning Outcomes. Learning Style

14.1. Basic Concepts of Integration. Introduction. Prerequisites. Learning Outcomes. Learning Style Basic Concepts of Integration 14.1 Introduction When a function f(x) is known we can differentiate it to obtain its derivative df. The reverse dx process is to obtain the function f(x) from knowledge of

More information

Creating a Simple Macro

Creating a Simple Macro 28 Creating a Simple Macro What Is a Macro?, 28-2 Terminology: three types of macros The Structure of a Simple Macro, 28-2 GMACRO and ENDMACRO, Template, Body of the macro Example of a Simple Macro, 28-4

More information

Solving simultaneous equations using the inverse matrix

Solving simultaneous equations using the inverse matrix Solving simultaneous equations using the inverse matrix 8.2 Introduction The power of matrix algebra is seen in the representation of a system of simultaneous linear equations as a matrix equation. Matrix

More information

SQL Server 2005: Report Builder

SQL Server 2005: Report Builder SQL Server 2005: Report Builder Table of Contents SQL Server 2005: Report Builder...3 Lab Setup...4 Exercise 1 Report Model Projects...5 Exercise 2 Create a Report using Report Builder...9 SQL Server 2005:

More information

Content Author's Reference and Cookbook

Content Author's Reference and Cookbook Sitecore CMS 6.5 Content Author's Reference and Cookbook Rev. 110621 Sitecore CMS 6.5 Content Author's Reference and Cookbook A Conceptual Overview and Practical Guide to Using Sitecore Table of Contents

More information

Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

More information

Statgraphics Getting started

Statgraphics Getting started Statgraphics Getting started The aim of this exercise is to introduce you to some of the basic features of the Statgraphics software. Starting Statgraphics 1. Log in to your PC, using the usual procedure

More information

Client Marketing: Sets

Client Marketing: Sets Client Marketing Client Marketing: Sets Purpose Client Marketing Sets are used for selecting clients from the client records based on certain criteria you designate. Once the clients are selected, you

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Microsoft Excel Tutorial

Microsoft Excel Tutorial Microsoft Excel Tutorial by Dr. James E. Parks Department of Physics and Astronomy 401 Nielsen Physics Building The University of Tennessee Knoxville, Tennessee 37996-1200 Copyright August, 2000 by James

More information

Manual English KOI Desktop App 2.0.x

Manual English KOI Desktop App 2.0.x Manual English KOI Desktop App 2.0.x KOI Kommunikation, Organisation, Information Comm-Unity EDV GmbH 2010 Contents Introduction... 3 Information on how to use the documentation... 3 System requirements:...

More information

Comparing Simple and Compound Interest

Comparing Simple and Compound Interest Comparing Simple and Compound Interest GRADE 11 In this lesson, students compare various savings and investment vehicles by calculating simple and compound interest. Prerequisite knowledge: Students should

More information

Tutorial Guide to the IS Unix Service

Tutorial Guide to the IS Unix Service Tutorial Guide to the IS Unix Service The aim of this guide is to help people to start using the facilities available on the Unix and Linux servers managed by Information Services. It refers in particular

More information

Chapter 2: Software Development in Python

Chapter 2: Software Development in Python Chapter 2: Software Development in Python The goal of this textbook is to introduce you to the core concepts of computing through an introduction to programming in Python. In this chapter, we will focus

More information

HOUR 3 Creating Our First ASP.NET Web Page

HOUR 3 Creating Our First ASP.NET Web Page HOUR 3 Creating Our First ASP.NET Web Page In the last two hours, we ve spent quite a bit of time talking in very highlevel terms about ASP.NET Web pages and the ASP.NET programming model. We ve looked

More information

ACCESS 2007. Importing and Exporting Data Files. Information Technology. MS Access 2007 Users Guide. IT Training & Development (818) 677-1700

ACCESS 2007. Importing and Exporting Data Files. Information Technology. MS Access 2007 Users Guide. IT Training & Development (818) 677-1700 Information Technology MS Access 2007 Users Guide ACCESS 2007 Importing and Exporting Data Files IT Training & Development (818) 677-1700 training@csun.edu TABLE OF CONTENTS Introduction... 1 Import Excel

More information

Creating Cost Recovery Layouts

Creating Cost Recovery Layouts Contents About Creating Cost Recovery Layouts Creating New Layouts Defining Record Selection Rules Testing Layouts Processing Status Creating Cost Recovery Layouts About Creating Cost Recovery Layouts

More information

DiskPulse DISK CHANGE MONITOR

DiskPulse DISK CHANGE MONITOR DiskPulse DISK CHANGE MONITOR User Manual Version 7.9 Oct 2015 www.diskpulse.com info@flexense.com 1 1 DiskPulse Overview...3 2 DiskPulse Product Versions...5 3 Using Desktop Product Version...6 3.1 Product

More information

Prescribed Specialised Services 2015/16 Shadow Monitoring Tool

Prescribed Specialised Services 2015/16 Shadow Monitoring Tool Prescribed Specialised Services 2015/16 Shadow Monitoring Tool Published May 2015 We are the trusted national provider of high-quality information, data and IT systems for health and social care. www.hscic.gov.uk

More information

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

More information

Training Manual. Version 6

Training Manual. Version 6 Training Manual TABLE OF CONTENTS A. E-MAIL... 4 A.1 INBOX... 8 A.1.1 Create New Message... 8 A.1.1.1 Add Attachments to an E-mail Message... 11 A.1.1.2 Insert Picture into an E-mail Message... 12 A.1.1.3

More information