MatlabTutorial - Matlab Tutorial Basic Screen Youll notice...

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

View Full Document Right Arrow Icon
Matlab Tutorial Basic Screen You’ll notice the three main windows are "Workspace", "Command History", and "Command Window". The Workspace window is a list of everything used currently in your workspace. In this case it contains three matrices or arrays of size 1 X 80000. You’ll learn more about what can appear here later. The Command History window shows the list of commands that you’ve executed already. The Command Window window is probably the one that you’ll spend the most time looking at (which is why it’s the biggest). It shows results, commands,
Background image of page 1

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

View Full DocumentRight Arrow Icon
errors, etc. .. Basically, everything you’d want to know about what’s currently going on. The next part of the tutorial comes directly from the script file above. Please use that if available to follow along, this is simply a more printable version of the tutorial.
Background image of page 2
Assignments Here are a few basic assignment statements think of an assignment as a variable. a = 25; b = 42*12; c = 50 d = 36*12 + 120 Note that when the semicolon is present that Matlab doesn’t display the results on the screen, otherwise is does display the results after the command is executed. Important commands clear command The clear command is very important, it simply clears a variable from the workspace. clear a; clear b clear c clear all; "clear all" clears EVERYTHING from the Matlab Workspace. It is recommended that you always put "clear all" as the first line of your M-file so that you don’t have anything in your workspace that may cause problems with your script. help command The help command is another critical command to know. If you don’t know what a particular command does you can always type "help <command>" and it will display what the command does and how to use it. help clear; help help; lookfor command The lookfor command is for that time when you don’t know what the name of the command you’re looking for is. Type "lookfor <keyword>" and it will search the first line of the comments for each command and return matches. Note, it sometime can take awhile. lookfor fourier;
Background image of page 3

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

View Full DocumentRight Arrow Icon
Vectors Vectors form the basis of everything in Matlab. Becoming familiar with this concept is a must when working with Matlab. Think of a vector as a 1 X N matrix. Since Matlab is a numerical solver it requires that input to Matlab be completely numerical (not algebraic). a = [1 2 3] b = [4 5 6] a b a*b This command returned an error didn’t it? This is because Matlab tried to multiply a 1 X 3 vector times a 1 X 3 vector. Since vectors are really just 1 X N matrices this obviously creates a problem. You need to first decide what you desire from the result. Do you want the two to be multiplied like two matrices or do you want the corresponding elements of each matrix multiplied individually? The tick mark ’ (same key as double quote) is used to imply the transpose of a
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/13/2010 for the course MENG mctr701 taught by Professor Ahmed during the Spring '10 term at American University in Cairo.

Page1 / 15

MatlabTutorial - Matlab Tutorial Basic Screen Youll notice...

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

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