The present value of an annuity (a yearly sum of money) may be computed from the formula: Modify the M-file code from 2.1 to annotate the plot with labels for the axes, a title for the plot, and a grid.Įxercise 3 Use one of M/O/F to solve the following problems:ģ.1. Show your lab instructor your M-file will run when you type its name to the command prompt.Ģ.3. Save it on the Desktop, and add the Desktop to the Matlab search path (File | Add path). Take the code you entered, and paste it into an M-file, named exp_plot. Include the code and the plot in your reportĢ.2. Enter and run the lines of code to the right. Use M/O/F array manipulation methods to modify the matrix from Exercise 1.4, so that the column you added in Exercise 1.4 becomes the first column instead of the third column.Ģ.1. In other words, 1 will be the top most element in the column, the next element down the column will be 2, and so forth down the column.ġ.5. Use M/O/F array manipulation methods to add a third column to the matrix from Exercise 1.3, such that its elements number off the rows. Do this using the vector v rather than having to re-type the values.ġ.4. Use M/O/F array manipulation methods to build a two-column matrix where the first column consists of the values from Exercise 1.2, and the second column consists of the values from the first column converted into degrees. If you were asked to create a vector p consisting of the last row of A, instead of simply typingġ.3. This means for you to use the abilities that M/O/F has to operate on arrays to get your required results, rather than just retyping individual elements. Note: M/O/F ‘knows’ π natively, so you can form a value like 2 π by typing: 2*pi Exercises 1.3 – 1.4 below ask you to use array manipulation methods in M/O/F to accomplish the required task. Create a vector named angles of values from 0 to 2 π radians in increments of π/10. Create a vector named v of evenly spaced values from 0 to 20 (inclusive) in increments of 1.ġ.2. For example, if displaying the contents of some array or vector will take many lines, consider showing an abbreviated set of lines that will give adequate evidence that your solution is correct.ġ.1. Try to also document your output in a sensible way. One way to do this is to cutand-paste from the command window. Your report must document the steps or M/O/F command used to obtain the result. It is free software released under the terms of the GNU General Public License.Exercise 1 Use one of Matlab/Octave/FreeMat (M/O/F, for short) to do the following exercises. It is written in Common Lisp and runs on all POSIX platforms such as Mac OS X, Unix, BSD, and Linux as well as under Microsoft Windows. Maxima is a complete computer algebra system based on a 1982 version of Macsyma. Due to the open source nature of the software, some user contributions have been integrated into the main program. Scilab is available free of cost under an open source license. Scilab also includes a package called Scicos for modeling and simulation of explicit and implicit dynamical systems, including both continuous and discrete sub-systems.Īs the syntax of Scilab is similar to MATLAB, Scilab includes a source code translator for assisting the conversion of code from MATLAB to Scilab. The software can be used for signal processing, statistical analysis, image enhancement, fluid dynamics simulations and numerical optimization. While the language provides simple matrix operations such as multiplication, the Scilab package also provides a library of high level operations such as correlation and complex multidimensional arithmetic. This allows users to rapidly construct models for a range of mathematical problems. By utilizing matrix based computation, dynamic typing and automatic memory management, many numerical problems may be expressed in a reduced number of code lines, as compared to similar solutions using traditional languages, such as Fortran, C or C++. The language provides an interpreted programming environment, with matrices as the main data type. Scilab is a high level, numerically oriented programming language. As part of the GNU Project, it is free software under the terms of the GNU General Public License. Octave is a computer program for performing numerical computations. FreeMat is available under the GPL license. It is similar to commercial systems such as MATLAB from Mathworks, and IDL from Research Systems, but is Open Source. FreeMat is a free environment for rapid engineering and scientific prototyping and data processing.
0 Comments
Leave a Reply. |