Syllabus for ME 305 — Engineering Computer Applications

Fall 2015


Course description

This course provides an introduction to engineering computer applications with specific emphasis on Matlab. Students learn how to navigate the Matlab environment and create professional engineering graphics. Programming is taught with application to numerical solution of mathematical and engineering problems. Prerequisites: GE 206 and MTH 271.

General information

Rico Picone, PhD
Instructor Email
rpicone (at) stmartin (dot) edu
Office Hours
MWF 11 am–12 pm, Cebula 103C
Office Hours
MW 1:30 pm–2:30 pm, Cebula 103C
Cebula 101
MW 11:00–12:20
ME 305 Website
ME 305 Moodle



Kermit Sigmon. MATLAB Primer. Third Edition, 1993.

Harold Abelson and Gerald J. Sussman with Julie Sussman. Structure and Interpretation of Computer Programs. Second Edition. MIT Press, 1996.


Course notes will be here.


The following schedule is tentative.

week topics introduced reading assignment due
1 introduction to computer programming Assignment #1
2 assignment, processes, data, data types Assignment #2
3 introduction to linear algebra Assignment #3
4 arrays and array operations Assignment #4
5 conditionals and loops Assignment #5
6 functions Assignment #6
7 2D graphics Assignment #7
8 3D graphics Assignment #8
Midterm Exam
9 statistics Assignment #9
10 differential equations Assignment #10
11 state space models Assignment #12
12 introduction to software design Assignment #13
13 algorithms Assignment #11
14 symbolics Assignment #14
15 symbolics Assignment #15
16 finals week Final Exam


Assignment #1

  1. Do the assigned reading.
  2. Write an expression in a MATLAB Command Window that returns the numerical value 8.
  3. Multiply the previous result, using the ans variable, by 3.
  4. Compare the result, using ans, to 24. Does the comparison return 1 or 0? What does this mean?
  5. Do spaces matter when you write an expression?
  6. In MATLAB, is there a difference between the numbers 1 and 1.0?
  7. Which computer hardware component stores lots of data, but is relatively slow.
  8. Which type of language is MATLAB? High-level, Assembly Language, or Machine Code?
  9. Which computer hardware component processes, stores, sends, and receives data?
  10. Which numeral system do we use most often?
  11. How many numbers can be described by a binary numeral system that has only three digits? (Hint: the base-10 number 1 has representation 001 and the base-10 number 2 has representation 010).
  12. Take the weekly homework quiz.

Assignment #2

  1. Do the assigned reading.
  2. Write a program that has the following features:
    • it generates a random integer between 1 and 10,
    • it asks the user to input their guess of the number (use the input command … type help input to learn about it),
    • if the user has guessed the correct number, it congratulates the user,
    • if the user’s guess wass incorrect, it tells them they get a “strike,” tells them if they were low or high with their guess, and prompts for a second guess,
    • it repeats this until they get either three “strikes,” in which case they lose, or they guess the correct number.
  3. Take the weekly homework quiz.

Assignment #3

  1. Write a program that has the following features:
    • it finds the following products: \begin{align} 8 \begin{bmatrix} 6 \\ 2 \\ -1 \end{bmatrix}, && -3 \begin{bmatrix} 4 & -6 \\ 3 & 27 \end{bmatrix}, && \begin{bmatrix} 5 & 3 \\ 9 & 12 \end{bmatrix} \begin{bmatrix} 5 \\ 2 \end{bmatrix}, && \begin{bmatrix} 13 & 3 & 135 \\ -3 & 7 & -3 \\ 0 & 35 & 1 \end{bmatrix} \begin{bmatrix} -4 \\ 1 \\ -3 \end{bmatrix}, \end{align} \begin{align} -3 \begin{bmatrix} 4 & -6 \\ 3 & 27 \end{bmatrix} \begin{bmatrix} 0 & -1 \\ -3 & 2 \end{bmatrix}, && \begin{bmatrix} 13 & 3 & 135 \\ -3 & 7 & -3 \\ 0 & 35 & 1 \end{bmatrix} \begin{bmatrix} 0 & -44 & -6 \\ 0 & 1 & 16 \\ 0 & 1 & 1 \end{bmatrix}; \end{align}
    • it defines an array x with values 1, 2,, … ,1000;
    • it changes the value of the element of x that is at index 507 to equal 49.
    • it sums all the values of the new x array, and assigns the result to y.
    • if y is greater than 1e4 ($10^4$), display the string 'acheivement unlocked'. Otherwise, display the string 'no. just, no.'.
  2. Let $x = 2 e^1 - 4 e^2$ be a vector in vector space $\mathbb{R}^2$. Using the standard basis $e=(e^1,e^2)$ for $\mathbb{R}^2$, write the vector’s coordinate tuple $x_e$.
  3. Derive the linear map $A: \mathbb{R}^2 \rightarrow \mathbb{R}^2$ that is the change-of-coordinate matrix from the standard basis to the basis $b = (3 e^1, -1 e^2)$.
  4. Write a matlab script that takes a vector coordinate tuple (array) x, in the standard basis $(e^i)$, transforms it to the $(b^i)$-basis, and assigns it to the vector coordinate tuple (array) y.
  5. Turn in the homework in class on Wednesday.

Assignment #4

  1. Write a script that estimates the standard deviation of a random variable that has a gaussian probability density function using the function randn. Generate a 20 by 1 array that contains elements that have an increasing number of samples for the estimate. The first element is the estimate after 10 samples, and each element thereafter is the estimate after 10 more samples.
  2. Write a script that evaluates each element of an array and determines if it is positive, negative, or zero. Let the array be a 20 by 1 array of random integers (including zero) with uniform probability density function ranging from -5 to 5. When evaluating each element, if the element is positive, print +; if negative, print -; if zero, print 0.
  3. Please turn in the homework in class, Wednesday 09/23.

Assignment #5

  1. Write a program file that defines the function rect_int that performs numerical integration on input data as follows. Let there be four inputs: (1) data for the one-dimensional data array to be integrated, (2) delta_t for the scalar time steps between each data point, (3) lower time limit of integration, and (4) upper time limit of integration. Estimate the integral of data over time using the rectangular rule that you learned in calculus.
  2. Use rect_int to estimate the integral of tanh from 0 to 3 using 100 rectangles.
  3. Repeat problems 1 and 2, but create and use a function mid_int that uses the midpoint rule.
  4. Repeat problems 1 and 2, but create and use a function trap_int that uses the trapezoid rule.
  5. Compare and discuss the results.
  6. Turn in your homework in class, Wednesday.

Assignment #6

  1. Write a script that plots the upper half of a hemisphere of radius 5. Turn the edge colors off so that the mesh isn’t shown. Use the hot colormap and use lighting. Use a colorbar.
  2. Write a script that plots the function $e^{-r}\, \cos{2\pi r}$, where $r$ is the radial coordinate $r = \sqrt{x^2 + y^2}$. Color the faces blue, turn edges off, and use lighting. Turn on a Grateful Dead album. Dive in.

Assignment #7

Write a function with arguments a time array t, “data” y that is approximately sinusoidal, and the angular frequency of that data omega. The function should return an array [a1, a2, a3] where the elements of the array give the linear least-squares best-fit for the function $$y(t) = a_1 + a_2 \cos(\omega t) + a_3 \sin(\omega t).$$ Test your function on this data, which has angular frequency $\omega = 2\pi\ rad/s$. Your writeup should show the results of this, including a plot of the noisy data and your analytic least-squares approximation. (Note: this used to say $\omega = 1\ rad/s$, which was totally incorrect.)

Assignment #8

Write a script that numerically solves the differential equation $$ \ddot{x} + 2 \zeta \omega_n \dot{x} + \omega_n^2 x = f(t), $$ for $x(t)$. Let $f(t)$ be the function $$ f(t) = A \sin{\omega t}, $$ where $A$ is the drive amplitude and $\omega$ is the drive frequency. Use initial conditions $x(0) = 1$ and $\dot{x}(0) = 0$. Show a plot of $x(t)$ for the case that $\zeta = 0.5$, $\omega_n = 20 \pi\ rad/s$, $A = ½$, and $\omega = 10 \pi\ rad/s$.

Assignment #9

  1. Design the Butterworth filter below by choosing its parameters to meet the following design criterion: at $1\, kHz$, the output amplitude is approximately $20\%$ of the input amplitude. In order to aid in the design, simulate the response of the system to a sinusoidal input voltage $V_s(t) = A\,\sin{\omega t}$ with $A = 10\, V$, $\omega = 2000\pi$. Turn in your simulation code and a plot showing 5 steady-state periods of the input and the output signals.
  2. Write and test a program (function) named text_to_code that converts an input string of English text to international Morse code. It should output an equivalent binary string of ones and zeros—a character for each “unit” of time—with a 1 representing the “on” state and a 0 representing the “off” state. A separate function code_to_blink should be written that takes the output of this string and displays a visual representation (e.g. blinking “light”). Finally, write a script that uses these two functions to visualize the Morse code of the following paragraph (from Kierkegaard’s Purity of Heart is to Will One Thing).
    Is not despair simply double-mindedness? For what is despairing other than to have two wills? For whether the weakling despairs over not being able to wrench himself away from the bad, or whether the brazen one despairs over not being able to tear himself completely away from the Good: they are both double-minded, they both have two wills. Neither of them wills one thing, however desperately they may seem to will it.


Class resources will be posted here throughout the semester.

Homework, quiz, & exam policies

Homework & homework quiz policies

Weekly homework will be due in class on Wednesdays, and it will be turned in for credit.

Working in groups on homework is strongly encouraged, but no copying is permitted.

Exam policies

The midterm and final exams will be in-class. If you require any specific accommodations, please contact me.

Calculators will be allowed. Only ones own notes and the notes provided by the instructor will be allowed. No communication-devices will be allowed.

No exam may be taken early. Makeup exams require a doctor’s note excusing the absence during the exam.

The final exam will be cumulative.

Grading policies

Total grades in the course may be curved, but individual homework quizzes and exams will not be. They will be available on moodle throughout the semester.

Homework quizzes
Midterm Exam
Final Exam

Academic integrity policy

Cheating or plagiarism of any kind is not tolerated and will result in a failing grade (“F”) in the course. I take this very seriously. Engineering is an academic and professional discipline that requires integrity. I expect students to consider their integrity of conduct to be their highest consideration with regard to the course material.

Correlation of course & program outcomes

In keeping with the standards of the Department of Mechanical Engineering, each course is evaluated in terms of its desired outcomes and how these support the desired program outcomes. The following sections document the evaluation of this course.

Desired course outcomes

Upon completion of the course, the following course outcomes are desired:

  1. students will have a clear understanding of basic computer programming techniques;
  2. students will understand data types, functions, conditionals, and loops;
  3. students will be able to program in MATLAB;
  4. students will be able to produce plots in MATLAB;
  5. students will be able to import data into MATLAB, manipulate it, and plot it;
  6. students will be able to do basic statistical analysis with MATLAB;
  7. students will be able to solve differential equations numerically in MATLAB;
  8. students will understand basic numerical analysis;
  9. students will be able to use the symbolic toolbox in MATLAB;

Desired program outcomes

The desired program outcomes are that mechanical engineering graduates have:
  1. an ability to apply knowledge of mathematics, science, and engineering;
  2. an ability to design and conduct experiments, as well as to analyze and interpret data;
  3. an ability to design a system, component, or process to meet desired needs;
  4. an ability to function on multi-disciplinary teams;
  5. an ability to identify, formulate, and solve engineering problems;
  6. an understanding of professional and ethical responsibility;
  7. an ability to communicate effectively;
  8. the broad education necessary to understanding the impact of engineering solutions in a global and social context;
  9. a recognition of the need for, and an ability to engage in life-long learning;
  10. a knowledge of contemporary issues; and
  11. an ability to use the techniques, skills, and modern engineering tools necessary for engineering practice

Correlation of outcomes

The following table correlates the desired course outcomes with the desired program outcomes they support.
desired program outcomes
desired course outcomes 1