100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

eng1060-computing-for-engineers-hd.pdf

Rating
-
Sold
-
Pages
28
Grade
A+
Uploaded on
01-04-2024
Written in
2023/2024

Exam study book ENG1060 of Steven C. Chapra, William John Palm, Wai Ho Li - ISBN: 9780070285125

Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Course

Document information

Uploaded on
April 1, 2024
Number of pages
28
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

lOMoARcPSD|5967629




Eng1060 computing for engineers hd


Computing For Engineers (Monash University)




StuDocu is not sponsored or endorsed by any college or university
Downloaded by IAN NJUGUNA ()

, lOMoARcPSD|5967629




EN G 1 0 6 0
M ATLAB ba sics
- Defining variables
- Syntax: variable_name = value(s)
- No special characters , . / : ; ~ ^ ! ? \
- No foreign characters Γ Ψ Ω Π ᾢ 안 녕 하 세 요 Ӫ Ɲ ũ Ậ
- Cannot start the variable name with a numerical character 0 1 2 3 4 5 6 7 8 9 Commented [tr1]: Must start with letter, is case sensitive
- No blank spaces e.g car acceleration Commented [tr2]: car_accel is acceptable


- Command window
- Treat like calculator
- Does not save work Commented [tr3]: Do work in m-files


- Operator precedence
1. Parentheses ()
2. Transpose (.’), power (.^), complex conjugate transpose (’), matrix power (^)
3. Unary plus (+), unary minus (-), logical negation (~)
4. Multiplication (.*), right division (./), left division (.\), matrix multiplication (*),
matrix right division (/), matrix left division (\)
5. Addition (+), subtraction (-)
6. Colon operator (:)
7. Less than (<=), greater than (>), greater than or equal to (>=), equal to (==),
not equal to (~=)
8. Element-wise AND (&)
9. Element-wise OR (|)
10. Short-circuit AND (&&)
11. Short-circuit OR (||)

- Built-in functions Commented [tr4]: Built-in variables
e.g. Imaginary number, Euler’s number, infinity, pi, NaN, etc.
– sqrt, mod, rem
– log, log10, exp
– sin, cos, tan
– round, ceil, floor = round to nearest, round down, round up
– min, max, sign

- Built-in commands Commented [tr5]: help <function name> or
doc <function name> for MATLAB help
clc: Clears the command window
clear all: Clears all variables
close all: Closes all figure windows
fclose all: Closes all files opened by MATLAB
who: Lists existing variables
whos: Lists existing variables and other properties
dir: Lists everything in the current directory




Downloaded by IAN NJUGUNA ()

, lOMoARcPSD|5967629




M a t r ice s
• A matrix is a variable with multiple values
• Also called arrays

- Creating 1D matrices (vectors) Commented [tr6]: Use apostrophe/transpose operator ‚
to convert row to column or visa versa
- Square brackets [ ] to create matrices
- Row vectors are horizontal
Syntax: A = [1 2 3 4] or A = [1, 2, 3, 4]
- Column vectors are vertical
Syntax: B = [5; 6; 7; 8]

- The Colon Operator Commented [tr7]: Use colon if given step size
- Creates a vector with equally spaced values using a specified spacing
- Syntax: start_value : step : end_value Commented [tr8]: Default step of 1 if step is omitted
A = [6 7 8 9 10] or A = 6 : 1 : 10 or A = 6 : 10
B = [6 11 16 21 26] or B = 6 : 5 : 26
C = [6 4 2 0 -2 -4] or C = 6 : -2: -4
- Colon operator to create column vectors?
Use round brackets with apostrophe: A = (1 : 20)’

- The linspace Function Commented [tr9]: Use linspace if given no. of values
- Create a vector with equally spaced values using a specified number of points
- Syntax: linspace(start_value, end_value, num_of_points)
A = [1 2 3 4 5 6] or linspace(1, 6, 6)
B = [3.8510 4.5158 5.1807 5.8455 6.5103 7.1752 7.84] or
B = linspace(3.851, 7.84, 7)

- Creating 2D matrices
- A 2-dimensional matrix contains multiple rows and columns
- Use square brackets [ ] to create a 2 dimensional matrix Commented [tr10]: Rows then columns
MATLAB refers to the rows first, then the columns
A = [1 2 3; 4 5 6] (2 × 3 matrix) or using colon operator A = [1:3; 4:6]

- Matrix concatenation & functions
- Matrices can be concatenated to make larger matrices
- Matrices can only join if one of their dimensions are the same
- Matrices can be created using
A = zeros(rows, columns)
B = ones(rows, columns)
C = eye(rows, columns) identity matrix I
D = rand(rows, columns)
- Matrix properties can be obtained using
Longest_side = length(matrix)
[rows, columns] = size(matrix)




Downloaded by IAN NJUGUNA ()
$2.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
Pieces

Get to know the seller

Seller avatar
Pieces Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
60
Last sold
-
Sell Notes online and Exams, Your no 1 NURSING COURSE EXAMS AND STUDY RESOURCES

Nursing course Exams and Notes Online NCLEX -RN, TEAS, HESI, NURSING Exams Detailed elaboration for the Answers, 100% success on your studies Best wishes.

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions