20-ENFD-112-00x

Engineering Fundamentals of Programming

Basic Programming Concepts and Modeling for Engineers

News
    05 Mar 08: Welcome to ENFD 112
    05 May 08: Midterm exam news
    07 May 08: Midterm sample questions
    07 May 08: Definition of mantissa
    23 May 08: Midterm Exam Results - Time is set, Room is Baldwin 550
    2 Jun 08: These people are exempt from the final exam
    3 Jun 08: Final Exam Prep

Quote of the Week
    Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest. .
              --- Issac Asimov (submitted by Nic Perry)
   
    Nothing in this world that's worth having comes easy.
              --- Obvious (submitted by Sarma)
   
    If you have a job you love, you will never work a day in your life.
              --- Thomas Edison (submitted by Nic Perry)
   
    Of all the said words of tongue or pen, the saddest are these: It might have been.
              --- Anonymous (submitted by Nic Perry)
   
    When one door closes another opens. But often we look so long so regretfully upon the closed door that we fail to see the one that has opened for us.
              --- Alexander Graham Bell (submitted by Amber McDonough)
   
    Experience is what you get when you don't get what you want.
              --- Anonymous (submitted by Wyatt Neal)

Preparedness Exam
    exam      answers

Questions (accumulated from all quarters)
    How can you find the ascii value of a character?
    What is the procedure for saving files from MATLAB and submitting solutions?
    How does one draw text in the middle of a plot?
    How do you interrupt a running program?
    Nonlinear gridding.

Syllabus
    html

Lecture Material
    Why Math?   Week1 (demo)   Draw a Circle   Five Questions   Rational Approx to pi   Visualize
    For, While, If   Read from file   Interpolation   Visualization   Functions   Pattern Match
    Multiplication    Min Cost Network    Random Variables   Craps   Classes   Linear Systems

Lecture Review
    Week1     Week2     Week3     Week4     Week7     Week8/9     Week10

Writing Comments for Lab Programs
    Students have asked about the comments we expect your programs to contain. Please consult this guide for answers.

Submitting Assignment Solutions
    The procedure assumes files are saved on the Q-Drive. Instructions for creating, editing, saving, sending via the Q-Drive are as follows:

To create an M-file while in MATLAB do the following:

  1. Drop the File menu, click on New, then select M-File.
  2. A blank edit window appears. Edit this in obvious fashion.
  3. In the edit window drop the File menu and click on Save-as. A File Selector box opens.
  4. Select the directory with a name like username on College of Engineering Samba Server, where username is your username.
  5. Click Save.
To open and edit an existing M-file do the following:
  1. Drop the File menu, click on Open. A File Selector box opens.
  2. Select the directory with a name like username on College of Engineering Samba Server, where username is your username.
  3. Select the file you wish to open and click Open (or double click on the file).
To submit saved M-files do the following:
  1. Log in to blackboard and enter your section of 20-ENFD-112.
  2. Click on assignments.
  3. Click to view the lab you are submitting files for.
  4. Attach the files.
  5. Submit.

Lab Assignments
    Lab number 1:     (pdf)        (html)
    Lab number 2:     (pdf)        (html)
    Lab number 3:     (pdf)        (html)
    Lab number 4:     (pdf)        (html)      Sample Data File
    Lab number 5:     (pdf)        (html)      Sample file: short sequence      Sample file: very long sequence
    Lab number 6:     (pdf)        (html)      Multiply      Add Big Integers
    Lab number 7:     (pdf)        (html)      Sample Data File - answer is 2947
    Lab number 8:     (pdf)        (html)      Probability Demonstration
    Lab number 10:     (pdf)        (html)      Data File - part I      Data File - part II
    Extra:                  Prob 1      Prob 2      Prob 3      Prob 4      File 1      File 2

Reasonable Solutions to Lab Assignments
    Lab number 1:     simple arithmetic     π rounded     Sums     Sums (better)     Population     sin(1/x)
    Lab number 2:     plotcircles.m
    Lab number 3:     Questions     Part I     Part II     Part III     Part IV    
    Lab number 4:     Plain way: interp.m
            Fancy way: interp_f.m     polygon_interp.m     inv_dist_squ_interp.m
            Sample use of fancy way: interp_f('plume.dat',0,20,20,@inv_dist_squ_interp);
    Lab number 5:     Plain way: pattern.m
    Lab number 6:     toBigInt.m     addBigInt.m     shiftLeft.m     multiplyLine.m     multiplyBigInt.m    
            fact.m     count_zeros.m     plot_count_zeros.m     f.m     showchars.m
    Lab number 7:     Plain way: mst.m     30.dat
            Fancy way: mst_1.m     30.dat
            Super duper way: mst_inv.m     400.dat
            Super duperest in the land way: mst_inv_1.m     400.dat
    Lab number 8:     uniform.m   triangle.m   gauss.m   central_uni.m   central_tri.m   
            doit.m   passlinebet.m   dontpasslinebet.m   comebet.m   dontcomebet.m   genround.m
    Lab number 10:     Part I: (Octave solution using lp_solve)
                   schedule_1_oct.m     S_oct.m     p1.dat     printSchedule_oct.m
            Part II: (Octave solution using lp_solve)
                   schedule_2_oct.m     S_oct.m     X_oct.m     P_oct.m     p3.dat     printSchedule_oct.m

Midterm Exams, Solutions, Grades
    2006 Exam     2006 Solutions
    2007 Exam     2007 Solutions
    2008 Exam     2008 Solutions

Final Exams, Solutions
    2006 Exam     2006 Solutions
    2007 Exam     2007 Solutions
    2008 Exam     2008 Solutions

Matlab Examples
    Basic console input
    Scalar operators
    Vectors and operators
    Product of Matrix and Vector
    Plot a circle
    Simple for loop and if statement
    Another for loop and if statement test
    Simple plot of a function
    Mesh plot
    Plot pressure vs. temperature of an ideal gas
    Read from file    data file to test:    PDXprecip.dat
    Factorial - implemented as a function
    Compute traffic flow    uses    poisson.m
    Throw dice    uses    random0.m    seed.m    dice.m
    A Queue Class (Object Oriented Programming - all files in directory @queue)
    queue.m     insert.m     remove.m     isempty.m     peek.m     display.m
---------------------------
Divide a matrix by a vector
    Plot height and speed of thrown ball
    Calculate distance between 2 points
    Plot the sprial of Archimedes
    Growth of bacteria in a culture
    Animate planet motion