Feed on
Posts
Comments

ENGG1801 Lab 4 Re-Cap

Announcement / Reminder

  • 5 new sets of SPOT quizzes are available. You can get to them through your USYD eLearning site.
  • Quiz 1
    • Runs in the first hour of Week 5′s lab, 50 minutes long.
    • 10 multiple choice from Excel, 10 multiple choice from Matlab
    • Closed book – no internet / Excel / Matlab
    • Worth 10% of final assessment mark
    • Must attend the scheduled lab
  • There’s still a lab next week – it’s in the second half of the lab session, so don’t think you can leave after the quiz!

Course material

This week, we had a go at matrices, first solving by hand and then solving using Excel and Matlab. Nothing too difficult there.

Have you experienced where you named a cell (or range) something, but want to get rid of it? Then when you go and try and name another cell (or range) with that name, it’ll jump to that cell instead. So how do we un-name a cell? The answer is a tool called "Name Manager". You’ll find the button in the Forumlas tab on your ribbon, or alternatively you can press CTRL+F3 to get to it.

We also did some more control flow exercises, this time using for loop and switch statement. So what is the difference between a while loop and a for loop, and why do we have these two different ones? Well in Matlab, a for loop is designed to traverse an entire array (or vector) and use the elements one by one. This means, you’ll go through the loop as many times as the number of items in the array. With the while loop, you’ll have to define the condition to hold true during the loop. We have these two different forms of looping mechanism because they are good for a different usage.

I still expect you to do all you Matlab exercises as an m-file, because it means you can go back and see what you’ve done at the end of the day. It makes what you write into a small functional units that anyone would be able to read and understand with minimal effort.

Also, remember to indent your code! See lectures for examples. It makes code a lot easier to read. Indentation logically separates what is the main program flow  from say what’s actually in a loop or a branch.

 

See you next week, and have a go at SPOT before the quiz!

Leave a Reply