1 / 12

Program Design Using MATLAB Lecture 3: Supporting Material Dr Kathryn Merrick

Program Design Using MATLAB Lecture 3: Supporting Material Dr Kathryn Merrick Tuesday 10 th March, 2009. Overview. From problem to program Defining a function Comments and code structure. An Introductory Problem…. Physics of a Stoppie.

shana
Download Presentation

Program Design Using MATLAB Lecture 3: Supporting Material Dr Kathryn Merrick

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program Design Using MATLAB Lecture 3: Supporting Material Dr Kathryn Merrick Tuesday 10th March, 2009

  2. Overview • From problem to program • Defining a function • Comments and code structure

  3. An Introductory Problem…

  4. Physics of a Stoppie Source: Bicycle and Motorcycle Dynamics http://en.wikipedia.org/wiki/Bicycle_and_motorcycle_dynamics

  5. From Problem to Program… • Understand the problem ‘in English’ • Develop a rough solution on paper • Implement the solution in MATLAB • Test your solution

  6. Example: A Stoppie Calculator • The problem ‘in English’: I’d like to write a program that can tell me if a particular bike can do a stoppie. • The rough solution: I’m going to write some code that can automatically compute the normal force on the rear wheel given the wheelbase and centre of mass height. Harley-Davidson FXD Honda VFR800

  7. Demo 1: Stoppie Calculator in MATLAB

  8. Pros and Cons of the Stoppie Calculator • Advantages: • Computation is done automatically • Disadvantages: • I have to manually enter the variable values every time • I have to write in the equation every time • There must be a better way….!

  9. Demo 2: A Better Stoppie Simulator

  10. Inspiration for Assignment 1 …

  11. Summary • After today’s lecture you should be able to: • Take a problem ‘in English’ and develop a rough solution • Use the MATLAB command line to implement a solution • Define simple functions as reusable solutions

More Related