**Class Information:**

**Instructor:**Kevin Wedeward (Workman 221, x5708, wedeward@ee.nmt.edu, www.ee.nmt.edu/~wedeward/)**Time/Place:**TR 09:30AM-10:45AM in Workman Center 116**Office Hours:**M-Th 11:00AM-12:00PM

**Corequisite:** MATH 103

**Textbook:**
Introduction to Engineering Programming: C, Matlab and Java by
Mark Austin and David Chancogne, 1999, John Wiley & Sons, ISBN-13
978-0471001164

- Companion site for book

**Description:** EE 251 presents concepts of computer
programming, and the C and Matlab programming languages. Applications
are those related to electrical engineering such as programming
hardware, data acquisition and analysis, and mathematical
calculations.

**Grading:**

- Homeworks (roughly weekly): 20%
- Quizzes (roughly weekly): 40%
- Projects: 40%

**Reading:**

- Look over chapters 1, 2 paying particular attention to sections 2.2.3, 2.3.1, 2.3.2, 2.4
- Chapter 3
- Appendix 1
- Chapter 4
- Chapter 5
- Chapter 6
- Chapter 7 (9/23/2014)
- Chapter 8 (9/30/2014)
- Sections 9.1-9.3 (10/15/2014)
- Chapter 12 (10/21/2014)
- Chapter 13 (10/21/2014)
- Chapter 14 (11/06/2014)

**Assignments:**

- Homework (HW) 1 due beginning of class (BOC) on Th 08/28/2014: Problem 3.2 nicely coded with output provided for inputs of -40 degC, 0 degC and 40 degC
- HW2 due BOC on T 09/09/2014:
- Declare and assign variables for the characters Y, o, d, a, !, and print them as characters on one line, integers on another line, and hexadecimal on another line.
- Problem 4.6 - Reproduce table (nicely formatted) as shown for variable/data types given in Tables 4.4 and 4.5. Note limit.h is described in Appendix and you may need to search internet for information on float.h.

- HW3 due BOC on Th 09/18/2014:
- Problem 5.8 - Use g = 9.81m/s^2, Vo = 100m/s, and give result as table with columns of theta (deg), flight time (sec), and range (m).
- Problem 5.11 - Use values of -1.0, -0.1, -0.01, 0, 0.01, 0.1, 1.0 for x, and give results as table with columns of x, exp_series, exp_math, and % difference.

- HW4 due BOC on Th 09/25/2014: Handout
- HW5 due BOC on Th 10/02/2014: Handout
- Project 1 due BOC on T 10/14/2014: Handout
- HW6 due BOC on T 10/21/2014:
- Problem 8.1 - Call the function twice in your main program to test with array given in the problem and the array {100, 99, 98, 97, ..., 80, 79, 78} (might be more easily defined in a loop).
- Problem 8.2 - Test your function using the array
{{95.7, 42.1, 65.5}, {48.5, 91.5, 3.5}, {80.0, 79.2, 84.9}, {14.2, 95.9, 93.4}}.

- Problem 9.4 - Test your function with values given in the problem; macros not required.

- HW7 due BOC on T 10/28/2014:
- Write a C program to read values for times from the input file times.txt; compute sin(5*pi*t) for each time t given in times.txt; output comma separated values of t, sin(5*pi*t) into an output file named output.csv; and compile the program using a makefile. Hand in a copy of your program, output file, and makefile.
- Write a C program to read comma separated values from the
input file input.csv; output the
values with rows and columns swapped as comma separated
values in an output file named output.csv which should look
something like
1.2699, 6.3236, 2.7850, ... 9.13376, 0.97540, 5.46882, ...

and compile the program using a makefile. Hand in a copy of your program, output file, and makefile.

- HW8 due BOC T 11/04/2014:
- Problem 3.2 (in Matlab) nicely coded as m-file with formatted output (via fprintf) for inputs (via input) of -40 degC, 0 degC and 40 degC
- Problem 13.1 nicely coded as m-file with formatted output - test with inputs m = 7 kg, k1 = 2.5 N/m, k2 = 1.25 N/m

- Project 2 due BOC on Th 11/06/2014: Handout, knownty.txt, desiredt.txt
- HW9 due BOC Th 11/13/2014:
- Problem 13.8 nicely coded with at least two functions (one to find the number of points inside the circle and another to draw the figure); test your program with D = 5; store coordinates (x,y) in a two dimensional array that is passed to both functions along with the circle's diameter; try different values of N, say 500 and 5000. Turn in the figure for N = 500, m-files/functions and results in the command window.
- Use matlab to plot (over two cycles) the sinusoidal voltage v = 170*cos(2*pi*f*t) V, current i = 20*cos(2*pi*f*t-pi/2) A and power p = vi W on the same plot in one figure and then as three separate subplots in one figure. Use a frequency of f = 60 Hz and make sure to label (x-axes, y-axes, title, legend, units, ...) the plots sufficiently and use grids. Turn in your m-files/functions and figures.

- HW10 due BOC Th 11/20/2014: Problem 14.9 noting
- data file can be found here experimental.data;
- reshape() might be useful along with built-in statistical functions;
- take the square root of the number of data points and round up to an integer value for the number of bins in the histogram;
- cumulative frequency/distribution will have same number of bins (bars) as the histogram and is a "running total" of the observations per bin in the histogram. It will tell us the number of values that have those values or greater.

- Project 3 due BOC T 12/02/2014: Handout, YouTube Episode 1 and Episode 2 videos on the research trailer from which the data files Trailer-Data_14-02-02_0001.txt and Trailer-Data_14-02-03_0000.txt were provided, and sample plot.
- Project 4 due by 9am on T 12/09/2014: Handout, sample netlists in mat-files (circuit1.mat, circuit2.mat, circuit3.mat, circuit4.mat), and sample plot.

**Resources:**

- A complete resource to learn C
- Video on the origins of Matlab

**Academic Honesty:**

- Copying assignments, either in part or whole, is not permitted. Students are encouraged to discuss assignments and assist each other with debugging programs, but all work submitted for grading should be that of the individual whose name appears on the assignment.
- Quizzes are to be performed individually without resources unless otherwise specified by the instructor.
- See http://infohost.nmt.edu/~nmtlib/INFO/ORef/plagiarism.html for information on avoiding plagiarism and the Undergraduate Course Catalog for New Mexico Tech's policy on academic honesty.