100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
eng1060-computing-for-engineers-hd.pdf $2.99   Add to cart

Exam (elaborations)

eng1060-computing-for-engineers-hd.pdf

 0 view  0 purchase
  • Course
  • Institution
  • Book

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

Preview 3 out of 28  pages

  • April 1, 2024
  • 28
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
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 (iannjuguna47@gmail.com)

, 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 (iannjuguna47@gmail.com)

, 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 (iannjuguna47@gmail.com)

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Pieces. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

76202 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$2.99
  • (0)
  Add to cart