EECE 301 Discussion 02 MATLAB Tutorial

EECE 301 Discussion 02 MATLAB Tutorial - MATLAB Tutorial...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
' 2005 Mark L. Fowler MATLAB Tutorial EECE 301 Prof. Fowler We will be using MATLAB in EE301 to illustrate ideas about C-T and D-T signals and systems. MATLAB is available on the computers on campus. You can also buy a student version to put on your own computer. In addition to this tutorial The MathWorks (the company that makes MATLAB) has a tutorial available. I have links to it on my EECE 301 web page. Be aware that there are lots of parts of MATLAB that we won&t need, so if you run across something that sounds unfamiliar don&t worry about it (for example, there are lots of matrix commands such eig and svd that we won&t be needing; there are also lots of fancy plotting functions that we won&t need, either).
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Using Commands MATLAB has two ways it can be used: (1) as a command line environment and (2) as a program-running environment; in fact, the two environments can be used together. Command Line Environment : You issue commands at a prompt and MATLAB returns results; the results can be stored in variables that can be named as desired (within certain limitations). Program-Running Environment : You call a program from the prompt; the program does a series of commands that have been stored in a so-called “m-file”. An m-file can, if desired, accept multiple inputs variables and return multiple output variables. In this tutorial handout I will mostly discuss the command-line environment. Once you start up MATLAB you get a window that has a command line prompt like this: >> Once you have that prompt you can issue MATLAB commands. Here are some you can try: “pwd” stands for “Present Working Directory” >> pwd ans = C:\MATLAB_S (your computer’s response here will likely be different). This returns the name of the “present working directory”; it is the most accessible directory for MATLAB. When you perform a load or save command (discussed later) it operates on this directory (unless otherwise specified to be some other directory). To change the pwd, use the cd command (it works much like the DOS cd command); type >> help cd for more info. You can also change the directory using the GUI interface of MATLAB.
Background image of page 2
3 Getting Help >> help command_name will provide help on the various commands. For example, >> help sum provides help on the “sum” command that sums the elements in a vector. There is even help on the help command: >> help help give help on using help. Also just typing help gives some information useful for finding help on the various types of MATLAB commands there are: >> help gives a list of topics or categories into which MATLAB commands are grouped. Then you can get help on a specific topic by entering: >> help topic_name For example, one of the topics listed when the command “ help ” is issued is “elfun,” which stands for “elementary math functions” so that entering >> help elfun gives a list of trigonometric functions, exponential functions, numeric functions (such as “round” and “sign”), and functions for dealing with complex numbers (such as “abs”,
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

EECE 301 Discussion 02 MATLAB Tutorial - MATLAB Tutorial...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online