matlab demystified
[...]... Later, we will investigate programming in MATLAB and we will show you how to create functions that can be called later in the command window 14 MATLAB Demystified Ending Your MATLAB Session OK we have gotten started with a few very basic MATLAB commands You might want to save your work and then shut down MATLAB How do you get it off your screen? Well you can end your MATLAB session by selecting exit from... will be using MATLAB version 7.1 in this book MATLAB is started just like any other Windows program Just go to your program files menu and search for the MATLAB folder When you click on it, you will see several options depending on your installation, but you will have at least the following three options • MATLAB (version number) • M-file editor • Uninstaller To start the program, you select MATLAB (7.1)... hit the enter key MATLAB will move to the following line awaiting further input OK, something you are probably wondering, as I was when I started using MATLAB, was how in the world do you control the way numbers are displayed on the screen? So far in our examples, MATLAB has been spitting out numbers with four decimal places This is known as short format in MATLAB It’s the default in MATLAB and if that’s... numerical solution MATLAB is widely used in universities, in national laboratories and at private companies Knowing MATLAB will definitely be a plus on your resume Now a word about this particular book This book is aimed squarely at the MATLAB beginner The purpose is not to wow experts with complicated solutions built with MATLAB Rather, the purpose of this book is to introduce a person new to MATLAB to the... 5.5000 In many instances, it is not desirable to have MATLAB spit out the result of an assignment To suppress MATLAB output for an expression, simply add a semicolon (;) after the expression In the following command sequence, first we just type in the assignment x = 3 MATLAB duly reports this back to us On the next line, we enter x = 3; so that MATLAB does not waste space by telling us something we... select MATLAB (7.1) The default MATLAB desktop will then open on your screen (see Figure 1-1) As shown in the figure, the screen is divided into three main elements These are • File listing in the current directory Figure 1-1 The MATLAB desktop CHAPTER 1 The MATLAB Environment 3 • Command History Window • Command Window The standard mix of menus appears on the top of the MATLAB desktop that allows you... write down if doing algebra on paper, MATLAB doesn’t know what to do with it On the other hand, MATLAB is completely happy if you assign the value 90 – 6 to the variable x by writing x = 90 – 6 6 MATLAB Demystified Another way that the assignment operator works more like an assignment in a computer program is in a recursive type assignment to a variable That is, MATLAB allows you to write x = x + 4 if... can type quit in the command window and MATLAB will close Quiz Use MATLAB to calculate the following quantities: 11 14 8 2 5 + 37 3 1 5 3 91.25 4 True or False If y has not been assigned a value, MATLAB will allow you to define the equation x = y ^2 to store in memory for later use 5 If the volume of a cylinder of height h and radius r is given by V = πr2h, use MATLAB to find the volume enclosed by a... is 12 cm high with a diameter of 4 cm 6 Use MATLAB to compute the sin of π/3 expressed as a rational number 7 Create a MATLAB m file to display the results of sin(π/4), sin(π/3), sin(π/2) as rational numbers CHAPTER 2 Vectors and Matrices One area where MATLAB is particularly useful is in the computer implementation of linear algebra problems This is because MATLAB has exceptional capabilities for handling... CHAPTER 1 The MATLAB Environment 7 >> x = 3; >> We can include multiple assignments on the same line For example, the following expressions are valid >> x = 2; y = 4; z = x*y z = 8 Notice the two semicolons, they tell MATLAB we don’t want to see the values of x and y When doing a lot of calculations, you may end up with a large number of variables You can refresh your memory by typing who in the MATLAB command . is the author of Linear Algebra Demystified, Quantum Mechanics Demystified, Relativity Demystified, Signals and Systems Demystified, and Statics and Dynamics Demystified. Copyright © 2007 by. Programming in MATLAB 97 Generating Histograms 98 Basic Statistics 103 Writing Functions in MATLAB 106 Programming with For Loops 110 Calculating Standard Deviation and Median 110 More MATLAB Programming. squarely at the MATLAB beginner. The purpose is not to wow experts with complicated solutions built with MATLAB. Rather, the purpose of this book is to introduce a person new to MATLAB to the