Monday, September 11, 2017

05 September '17- Day 3 Linear Interpolation and Math functions in C,

At the beginning of class Professor Mason walked around the room to check on our blinking LED Knight Rider lights as well as the homework problems.  We also began the third lab which was to incorporate switches onto the bread board to control the intensity of the LEDs.  First, we began with a program to control the LED at different intensity levels for a delay of 100 milliseconds. Here is a screen shot of the code:
(Program for using loops and LED at different intensity levels)
We then modified the program so that the LED would change brightness levels at varying intensities. Here is the code:
(Program modification to dim LED at different intensity levels)
Afterwards, we were given the task to incorporate a button on the bread board to control when the LED is turned on.  Here is a screen shot of the code for the button:
(Program for having button operate the LED)
Once the time allotted for the lab had expired, we began lecture and were introduced to linear interpolation.  We were also introduced to new math functions for C and briefly talked about Salinity of salt water along with open jet engines.  We were given some problems to work out on whiteboards involving linear interpolation and how we can use it to our benefit with solving the freezing temperature of seawater using given two data points from a temperature vs. salinity graph.
(The given problem to solve by hand first then write in C)
After talking it over with my lab partner, we came up with the following:
(Scratch work for salinity problem above)
Solving using linear interpolation with two data points looks like this:
(Hand calculation)
(Program for calculating temperature of seawater using linear interpolation)
The next topic we discussed was the new math functions to use in C. The math functions allow us to input equations that contain logarithmic functions, exponents, compute absolute values, and square roots as well as being able to round up or round down to the nearest integer.  These new commands were useful when we came to calculating and writing an equation in C to compute the velocity and acceleration of an open-rotor jet engine. 
(Some hand work examples involving the new math functions and predicted answer)
(More examples of math functions)
The next task was to implement the new math functions into programs written for an open-rotor jet aircraft engine example and computing the new velocity and acceleration at any given time.



(Hand written calculations to compare the program to)

(Screen shot of the program and verification of calculated values)






No comments:

Post a Comment