Ch01_Environment and Variables PDF

Summary

This chapter introduces MATLAB, a mathematical computing tool. It covers basic concepts like variables, assignments, and matrices. The author, Holly Moore, focuses on fundamental MATLAB operations.

Full Transcript

CHAPTER 1 -5 Rate of Change INTRODUCTION TO MATLAB Rate of tempe...

CHAPTER 1 -5 Rate of Change INTRODUCTION TO MATLAB Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change TOPIC OUTLINE Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 About MATLAB -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Getting into MATLAB Variables and Assignments 100 200 Statements Characters & Encoding 300 400 500 100 200 300 400 500 Vectors and Matrices MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Objectives Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 After studying this chapter you should be able to -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Start the MATLAB program and solve simple problems in the command window Identify and use the various MATLAB windows Name and use variables 100 200 Understand, define and use simple matrices in 300 MATLAB 400 Understand the order of operations in MATLAB 500 Understand the difference between scalar, array and 100 200 300 400 500 matrix calculations in MATLAB MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. What is MATLAB? Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 MATLAB is one of a number of -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour commercially available, sophisticated mathematical computation tools Others include: 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change MATLAB excels at: Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 Numerical calculations -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour – Especially involving matrices Graphics 100 200 MATLAB stands for Matrix Laboratory 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 ▪ Performing mathematical computations -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour and signal processing ▪ Analyzing and visualizing data (excellent graphics tools) 100 200 300 ▪ Modeling physical systems and 400 500 phenomena ▪ Testing engineering designs 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Why MATLAB? Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 time, hour 3 3.5 4 4.5 5 Easy to use Versatile Built in programming language 100 Not a general-purpose language like 200 300 C++ or Java MATLAB was originally 400 500 100 200 300 400 500 written in Fortran, then later rewritten in C MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Getting into MATLAB Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 In Windows or Apple operating systems -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour click on the desktop icon In Unix type MATLAB 100 At the shell prompt 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. MATLAB opens to a default window configuration Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour MATLAB uses a standard windows menu bar 100 200 To exit MATLAB 300 400 use the close 500 100 200 300 400 500 icon MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. MATLAB Windows Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 MATLAB uses several different -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour windows to display data, commands and results. 100 200 They are not necessarily all open 300 400 at once 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 Workspace Window 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Current Folder Window Lists files stored in the Command Window current directory 100 Enter commands at the prompt 200 300 400 MATLAB Windows 500 Command 100 200 300 400 500 History Window Records all commands issued in the command window – including MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. mistakes This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Let’s look at the windows one at a time Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Command Window Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 Similar to a scratch pad -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Once you hit Command enter, you can’t edit any Window commands 100 You can retype them or use the arrow 200 300 keys to retrieve commands and edit 400 500 them before hitting enter again 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Command History Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 Records the commands you issue -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour in the command window When you exit the command 100 200 window, or when you issue Command History the clc 300 400 command, the command window 500 100 200 300 400 500 is cleared But the command history remains MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Command History Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 You can transfer commands from -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour the command history to the command window – Double click on a command It executes immediately 100 200 – Click and drag into the command 300 400 500 100 200 300 400 500 window You can edit the command before executing MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Workspace Window Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Workspace Window 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour When you define variables in the command window, they are listed in the 100 200 300 400 500 100 200 300 400 500 workspace window MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Scalar 100 200 Vector 300 400 500 100 200 300 400 500 2-D Matrix MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Current Directory/Folder Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 The current folder window is a list -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour of files When you try to load information 100 from a file or try to save information – MATLAB uses the 200 300 400 500 100 200 300 400 500 current folder MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Document Window Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 If you double click on any variable -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour in the workspace window MATLAB launches a document 100 window containing the array editor 200 300 400 500 100 200 300 400 500 You can edit variables in the array editor MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. New Variable -5 Rate of Change Icon Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour The Document Window 100 200 displays the variable 300 400 editor 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Figure Window Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 When Figures are created a new -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour window opens It’s extremely easy to create 100 200 graphs in MATLAB 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour First create a vector of x values – then a corresponding vector of 100 y values 200 300 400 500 100 200 300 400 500 Note: The semicolon suppresses the output from each command MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Matlab makes it easy to modify graphs by adding Titles Axis labels Legends 100 200 300 Other types of annotations 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Editing Window Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 This window allows you to type -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour and save a series of commands without executing them 100 200 There are several ways to open 300 400 an editing window 500 100 200 300 400 500 – From the file menu – With the new file icon MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour 100 200 Open an editing window 300 from the file menu or with 400 the new file icon 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour New file icon 100 200 300 400 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour Save and Run 100 200 300 400 500 100 200 300 400 500 Write your code in the editing window, then run it using the Save and Run icon MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. 1.2 Variables and Assignment Statements Rate of Change -5 Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 MATLAB allows you to assign a -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour value to a variable A=3 100 200 Should be read as A is assigned a 300 400 value of 3 Use the variables in subsequent 500 100 200 300 400 500 calculations MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. -5 Rate of Change Naming Variables Rate of temperature change, degrees/hour -4.5 -4 -3.5 -3 -2.5 -2 -1.5 All names must start with a letter -1 -0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 time, hour They may contain letters, numbers and the underscore ( _ ) 100 200 Names are case sensitive There are certain keywords you 300 400 can’t use 500 100 200 300 400 500 MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458. Use the iskeyword function for a list of keywords Rate of Change -5 Rate of temperatur

Use Quizgecko on...
Browser
Browser