Beruflich Dokumente
Kultur Dokumente
ENGINEERING
ENG1060
HOUSEKEEPING
News forum
– Be aware that there is a news forum for important announcements
2
ENG1060
WORKSHOPS
3
ENG1060
RECAP: COMMENTS
4
ENG1060
RECAP: COMMENTS
5
ENG1060
RECAP: SECTIONING
6
ENG1060
Computers don't get tired of repeating the same mundane tasks over and
over again
We write code with a purpose that the same code can be used many times
for different problems
– Being generic means that the code is applicable to many different problems
– Makes you more employable as an engineer/scientist
7
ENG1060
A = input('text'): Prints out the text string and awaits an input from the user to
store into variable A
EXAMPLE 1
Use the eye, ones and zeros commands to create the following matrices:
1 0 1 1 0 0
𝐴𝐴 = , 𝐵𝐵 = , 𝐶𝐶 =
0 1 1 1 0 0
Using the variables A, B and C, write a command that creates the following
matrix D
1 0 2 2 0 0
0 1 2 2 0 0
𝐷𝐷 =
0 0 2 2 2 1
0 0 2 2 1 2
9
ENG1060
EXAMPLE 2
∞ 9/10 𝑛𝑛
∑𝑛𝑛=1
𝑛𝑛
converges to log 𝑒𝑒 10 .
Do this by computing the sum for n=10, 20, 50 and 100. Plot the sums as blue
diamonds and loge(10) as a red line.
10
ENG1060
EXAMPLE 2
∞ 9/10 𝑛𝑛
∑𝑛𝑛=1
𝑛𝑛
converges to log 𝑒𝑒 10 .
11
ENG1060
EXAMPLE 3
The demand for water during a fire is often the most important factor in the
design of distribution storage tanks and pumps. For communities with
populations less than 200,000 the demand Q (in L/min) is given by
𝑄𝑄 = 3.78 × 1020 𝑃𝑃 1 − 0.01 𝑃𝑃
Calculate the demand for P between 10 and 200 and plot the results.
12
ENG1060
EXAMPLE 3
The demand for water during a fire is often the most important factor in the
design of distribution storage tanks and pumps. For communities with
populations less than 200,000 the demand Q (in L/min) is given by
𝑄𝑄 = 3.78 × 1020 𝑃𝑃 1 − 0.01 𝑃𝑃
13
ENG1060
EXAMPLE 4
14
ENG1060
EXAMPLE 4
On a new figure, use subplots to plot each order Bessel function in separate
panels
15
ENG1060
1. Introduction to ENG1060
2. MATLAB basics
3. Matrices
4. Plotting
5. Good programming practices
6. Functions
7. Input and output
8. IF statements
9. Loops, loops, loops…
10. Debugging MATLAB programs
11. Advanced functions
12. Data types and MATLAB limitations
16