# Tutorial1 - CME 100 Fall 2011 Vector Calculus for Engineers...

This preview shows pages 1–3. Sign up to view the full content.

CME 100, Fall 2011 Vector Calculus for Engineers Prof. Eric Darve Matlab Tutorial – 1 Matlab is a high-level computer language for scientiFc computing and data visualization built around an interactive programming environment. Using the interactive system, we can perform simple and complicated arithmetic operations, enter commands and see the output immediately. 1. Simple Arithmetic using the Command Window We can use Matlab’s command window for simple arithmetic. When you invoke Matlab to begin a session, you see the prompt >> . When we give instructions for an operation following this prompt, we say that we are working on the command line. >> 5+7 ans = 12 >> 1432-55 ans = 1377 >> 3*127 ans = 381 >> 4^5 ans = 1024 >> 72/55 ans = 1.3091 >> exp(1) ans = 2.7183 2. Variables We can also do the above operations by assigning variable names to the quantities.

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

View Full Document
2 CME 100 >> x = 5 ans = 5 >> y = 7 ans = 7 >> z = x+y ans = 12 >> a = 1432 ans = 5 >> b = 55 ans = 7 >> c = a-b ans = 1377 >> v = 1 ans = 1 >> exp(v) ans = 2.7183 Following points will be useful when using the command window: Any line that begins with the % symbol will not be executed by Matlab and can be used to write comments. >> % This line is a comment >> If we do not wish to see the intermediate results, we can suppress the output by putting a semicolon at the end of the line. >> x = 5; >> y = 7; >> z = x+y ans = 12 To clear the screen in the command window, type clc .T oc l e a rt h em o r y associated with a particular variable, say x ,type clear x .
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/04/2011 for the course ECON 101 taught by Professor Capelli during the Winter '10 term at University of Michigan.

### Page1 / 7

Tutorial1 - CME 100 Fall 2011 Vector Calculus for Engineers...

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

View Full Document
Ask a homework question - tutors are online