It1005
Download
1 / 10

IT1005 - PowerPoint PPT Presentation


  • 99 Views
  • Uploaded on

IT1005. Lab session on week 6 (2 nd meeting). Lab 2 - Recap. By now, you must ensure that you are familiar with Matlab environments: Matlab main window, M-File Editor, Command Window, Workspace, Figure Window, Docking, etc.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' IT1005' - kevork


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
It1005

IT1005

Lab session on week 6

(2nd meeting)


Lab 2 recap
Lab 2 - Recap

  • By now, you must ensure that you are familiarwith Matlab environments:

    • Matlab main window, M-File Editor, Command Window, Workspace, Figure Window, Docking, etc.

    • Matlab debugger, breakpoint, stepping functions, looking at workspace during stepping, ‘go to cursor’, adjusting program based on the error messages, etc.

  • Remember that you can always just select Matlab codes using ‘Select tool’ in Adobe Acrobat, then do copy-paste to Matlab rather than typing it all again.

    • For lab assignments, for trying codes in lecture notes, etc.


Symbols and keyboard locations
Symbols and Keyboard Locations

The other keys should be quite straightforward…

http://en.wikipedia.org/wiki/Keyboard_layout#US


Review on array vector matrix
Review on Array/Vector/Matrix

  • Creation

    • mat = [], repmat, ones, zeros, eye, diag, rand, etc

  • Accessing elements/indexing (index start from 1!)

    • mat(indices), the usage of ‘:’, mat([indices1 … indicesn])

  • Manipulation: add, edit, delete row/col, sort, find

    • mat(:,x) = y

  • Operation: +, -, *, /, .*, ./

    • matA op matB, mat op scalar (scalar expansion)

  • Multidimensional array: 3-D…

    • We seldom go beyond 3D…


Quick test
Quick Test

  • Simple test to about array:

    • Create an array of size 4*5 with all ‘1’ (then all ‘0’).

      • Try repmat, manual creation, using [1;1;1;1]*[1 1 1 1 1] =)

    • Compute this: [1 2] .* [2 1] = [3 4] [2 1]

      • Change .* to *, ./, /, +, or -

    • Create this array [1 2 3; 4 5 6; 7 8 9],then perform these operations:

      • Change the 2nd row to 100 90 80!

      • Change the 3rd col to 20 10 0!

      • Change the main diagonal to all zeros!


Relational and logical operations
Relational and Logical Operations

  • Matlab relational operations

    • <, >, <=, >=, ==, ~=

    • relational operations on array  the result is array

    • floating-point imprecision  use eps

  • Logical operators

    • &, |, ~, &&, ||

    • short circuit


Quick test1
Quick Test

  • Simple test to about relational/logical operations:

    • How to make these statements produce ans = 1

    • You can only supply ONE single operatoror MATLAB function to replace ‘…’

      • 10+30*2-5/4 … 2*5-10

      • sin(pi) == 0?

      • … ( [10 20 30] / 10 ... [1 2 3] )

      • 10 > 20 ... 5 … 2

      • 10 > 5 … 5 > 2

      • … … 10 > 20 && 5 < 2 …


Lab 3 free and easy time
Lab 3 – Free and Easy Time

  • Now, you are free to explore Matlab,especially to find answers for Lab 3

  • For those who have done Lab 3, try this extra challenges!The solution is at the end of this session

    • There is a land of size 3m*5m

    • The height of each square meter on that land is known:[1 2 3 4 5; 2 3 4 5 6; 7 7 7 7 7] above sea level (denoted in meter).

    • A house of size 3*5 is going to be built there.

    • Before building it, the land must be leveled!

    • We want the land to have height 5m above sea level.

    • Question: what is the minimum amount of soil (in cubic meter) thatmust be added (or perhaps removed) in order to make this land flat?

    • Hint: explore array operations, Matlab function ‘sum’, and ‘mesh’ or ‘surf’!


Lab 3 marking midterm test
Lab 3 Marking + Midterm Test

  • I will be away

    • @ Jakarta, Indonesia during mid semester break

    • 22 Feb night – 2 March

  • Lab 3 marks will be available on 3 or 4 March.

    • Will not be as fast as Lab 0/1 last week.

  • If you have any questions, try IVLE forum first,ask your class mates, or ask Colin.

    • I will occasionally check my emails from home,but will not be able to reply that fast!

    • Or ask on Monday morning, before your Mid-term exam!


Remember this
Remember This!

  • E-mail answers to: stevenhalim at gmail.com

  • With subject header:

    • “IT1005-LabGroupID” “FullName”,

      • e.g. IT1005-7A StevenHalim

    • Mr Gmail will sort your emails for me =)

  • Try to submit your answers ONCE

    • Do not submit again to fix some minor mistakes!

  • Shorter (but correct) answers ~ better marks =)

  • Remember, I have ~100 emails/week !