COEN 231 MATLAB A Practical Introduction to Programming and Problem-Solving SOLUTION MANUAL 5th Edition BEST FOR EXAM Concordia University
COEN 231 MATLAB A Practical Introduction to Programming and Problem-Solving SOLUTION MANUAL Fifth Edition BEST FOR EXAM Concordia University I. Introduction to Programming Using MATLAB Chapter 1: Introduction to MATLAB Exercises 1) Create a variable myage and store your age in it. Add 2 to the value of the variable. Subtract 3 from the value of the variable. Observe the Workspace Window and Command History Window as you do this. >> myage = 20; >> myage = myage + 2; >> myage = myage - 3; 2) Create a variable to store the atomic weight of iron (55.85). >> iron_at_wt = 55.85; 3) Explain the difference between these two statements: result = 9*2 result = 9*2; Both will store 18 in the variable result. In the first, MATLAB will display this in the Command Window; in the second, it will not. 4) In what variable would the result of the following expression be stored: >> 3 + 5 ans 5) Use the built-in function namelengthmax to find out the maximum number of characters that you can have in an identifier name under your version of MATLAB. >> namelengthmax ans = 63 6) Create two variables to store a weight in pounds and ounces. Use who and whos to see the variables. Use class to see the types of the variables. Clear one of them using clearvars and then use who and whos again. >> clear >> pounds = 4; >> ounces = 3.3; >> who Your variables are: ounces pounds >> whos Name Size Bytes Class Attributes ounces 1x1 8 double pounds 1x1 8 double >> class(ounces) ans = 'double' >> clearvars ounces >> who Your variables are: ans pounds 7) Explore the format command in more detail. Use help format to find options. Experiment with format bank to display dollar values. >> format + >> 12.34 ans = + >> -123 ans = - >> format bank >> 33.4 ans = 33.40 >> 52.435 ans = 52.44 8) Find a format option that would result in the following output format:
Written for
- Institution
- Concordia University ( )
- Study
- Unknown
- COEN 231
Document information
- Uploaded on
- June 15, 2025
- Number of pages
- 283
- Written in
- 2024/2025
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
coen 231