Difference between revisions of "Getting started with MATLAB or Python"
Line 104: | Line 104: | ||
====Plot Window==== | ====Plot Window==== | ||
(6) When the MATLAB plot tools are used the resulting graphics are displayed in separate plot windows (more on this later). | |||
[[File:MATLAB_Windows_Labeled.PNG|center|400px]] | [[File:MATLAB_Windows_Labeled.PNG|center|400px]] | ||
Line 182: | Line 182: | ||
=====Built in Functions===== | =====Built in Functions===== | ||
MATLAB has an array of simple built in functions. Basically all of the rudimentary calculation types that you can think of (sin,cos,exp,etc.) have a built in MATLAB function that may be called at the command line and coded into a script or function file (as the need arises). A few examples are shown in the screenshot below. | |||
[[File:MATLAB_Common_Functions.PNG|center|400px]] | [[File:MATLAB_Common_Functions.PNG|center|400px]] | ||
Line 188: | Line 188: | ||
=====Built in Constants===== | =====Built in Constants===== | ||
MATLAB also has predefined variables for fundamental constants (ex. pi, Inf, i). Be wary though, as these can be easily overwritten by the user. As a rule of thumb try not to name your variables after any fundamental mathematical constant. | |||
[[File:MATLAB_constants.PNG|center|400px]] | [[File:MATLAB_constants.PNG|center|400px]] | ||
Line 194: | Line 194: | ||
=====fprintf() and disp()===== | =====fprintf() and disp()===== | ||
fprintf() and disp() provides a means of printing text to the command window. While obviously not useful at the command line (as the example below shows), these statements will become useful when you begin writing your own scripts and functions (either as a means of displaying intermediate results or as a means of tracking down bugs). disp() is simple display function that prints arrays or strings directly to the command window. fprintf() is a much more robust function that allows formatting of the string to be printed as well as output specification (for use in printing to files). The default output is set to the command window. | |||
[[File:MATLAB_fprintf.PNG|center|400px]] | [[File:MATLAB_fprintf.PNG|center|400px]] | ||
Line 200: | Line 200: | ||
=====Semicolon===== | =====Semicolon===== | ||
Placing a semicolon at the end of a line of code will suppress any output produced by that line | Placing a semicolon at the end of a line of code will suppress any output produced by that line. This (along with fprintf() and break points) can help in debugging code. Unless you are debugging it is good practice to end all lines of code with a semi-colon to avoid a bunch of garbage intermediate values being printed out at the command line. | ||
[[File:MATLAB_semi_colon.PNG|center|400px]] | [[File:MATLAB_semi_colon.PNG|center|400px]] |
Revision as of 12:24, 10 September 2010
Introduction
|
|
Access / Installation
|
|
Getting Started
|
|
Introduction to the Command Line
|
|
Scripts and Functions
|
|
Code Structures
|
|
Plotting Data
|
|
Additional Resources
|
|