1 / 20

The MATLAB Environment Variables Basic Commands Help

The MATLAB Environment Variables Basic Commands Help. HP 100 – MATLAB Wednesday, 8/27/2014 www.clarkson.edu/class/honorsmatlab. Who are we?. Jim: Junior Aeronautical – Mechanical Engineer elmerjc@clarkson.edu Joe: Senior Mechanical Engineer quinzijn@clarkson.edu. Quote of the Week.

Download Presentation

The MATLAB Environment Variables Basic Commands Help

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The MATLAB EnvironmentVariablesBasic CommandsHelp HP 100 – MATLAB Wednesday, 8/27/2014 www.clarkson.edu/class/honorsmatlab

  2. Who are we? • Jim: Junior Aeronautical – Mechanical Engineer • elmerjc@clarkson.edu • Joe: Senior Mechanical Engineer • quinzijn@clarkson.edu

  3. Quote of the Week “This is a full time campus. Believe me, there’s nothing exciting going on downtown.” Prof. Cetinkaya

  4. Before We Begin: • Any Questions? Comments? Concerns? • Feel free to contact Jim or Joe • We can set up small group tutoring or one-on-one • You can email us with questions or concerns • We are here for you! Even if it isn't about MATLAB

  5. Homework • Create and submit a PDF file using the publish tool in Matlab • Feel free to work in groups! • Do NOT have identical code • Questionable integrity will be examined • This is your FIRST & FINAL WARNING

  6. The MATLAB Interface Open MATLAB: Start  All Programs  MATLAB

  7. Double Click on variable and it will open this “excel” like editor MATLAB Interface [cont.]

  8. The Editor • The Editor is a supped up ‘notepad’ • It is where you will be spending most of your time. • It allows you to write your code, save it, open it up again, run it as well as many more advance options. • Open it from: • New Script • The “New” icon has options to create other different things like functions and GUIs

  9. The Editor [cont.] Save & Run script Line Number Where MATLAB will try to point out possible errors with your code, and offer suggestions! How nice!

  10. MATLAB FUNDAMENTALS • The 'Supped-Up Graphing Calculator' • In the command window: 25 + 5 <<enter>> • Result: ans = 30 <<line spaces removed>> • So… what does this mean? • You can use the command window like a scratch-pad or calculator, using familiar math symbols.

  11. MATLAB FUNDAMENTALS • Order of Operations • Parentheses left to right • Exponents left to right • Division AND Multiplication left to right • Addition AND Subtraction left to right

  12. MATLAB FUNDAMENTALS • Creating Variables / Arrays • The assignment operator = • <<variable_name>> = <<data to be stored>>; • Variable names must begin with a letter and can only contain letters, numbers, and the underscore. • Examples: • x = 1; • y = [1 2 3 4]; • z = [1 0 0; 0 1 0; 0 0 1];

  13. MATLAB FUNDAMENTALS • Variables and Arrays • Variables store values (numbers and text) • Scalar • Vector • Array (Matrix)

  14. MATLAB FUNDAMENTALS • Mathematical Operations with arrays • Use .* ./ .^ when using operation on an array or vector • Array Indexing • Indexing an array is to specify a specific location to extract its value and or to perform an operation. • Arrays are indexed as follows: • A(i,j)  Refers to the ith row and jth column. j i

  15. Elementary MATLAB Commands

  16. Numerical Display • See page 39 in your texts

  17. Help command • Help function: Universal! • Solves many problems created by Jim and Joe!! • ‘help’ is a great place to start when totally lost • ‘help _______’ insert a function in the blank ie cos, solve, plot, etc… • Mathworks website has an explanation for every function in matlab

  18. Publishing • Go to the Publish tab • Click the drop box below the Publish icon and select edit publishing options • Change the output format to PDF • Click the Publish icon

  19. Questions? • Questions? • HW # 1 • Due by 5:00 PM, Wednesday September 3rd, to cuhonorsmatlab@gmail.com • You are to submit: • PDF file of your published code • Make sure to use comments % Question 2.2 • Problems: 2.2, 2.3, 2.4

  20. Homework Example • Go to Problem 2.3 in your books • Step 1: Create variables for numbers 1-9 • Step 2: Evaluate each equation using only the variables you created • Step 3: Create a 3x3 array containing numbers 1-9 • Step 4: Evaluate each equation using only references to the array you created

More Related