Machine Problem 2: Look-up Table
By:
Glenn Matthew G. Manalese
2011-01573
Submitted to:
Mr. Maxell Lumbera
19 February 2013
College of Engineering
University of the Philippines-Diliman
I.
Introduction
The amout of pollutants released by motor vehicles in a community can affect a lot of its sectors (such as agriculture, tourism), and the health of its occupants. But in transportation engineering, these amounts of pollutan ts can be predicted given the average speeds of the passing cars.
In this machine problem, a program that would calculate the amount of pollutants released by vehicles is developed by interpolating their values from the given data below: Speed[kph]
96.000000
88.000000
80.000000
72.000000
64.000000
56.000000
48.000000
40.000000
CO[g/v-km]
4.519000
4.519000
4.819000
4.963000
5.244000
5.956000
6.519000
7.938000
HC[g/v-km]
0.594000
0.594000
0.625000
0.681000
0.738000
0.763000
0.850000
0.963000
NOx[g/v-km]
1.163000
1.163000
1.075000
1.019000
0.938000
0.906000
0.850000
0.825000
The program will use the Lagrangian Interpolating Polynomial method to interpolate. II.
Objectives
In this machine problem, there are three primary objectives to be accomplished.
1. To store the table above into a file,
2. To read the file from (1) and to print it hard copy of it (interpreted as to print it to a .csv file, along with the interpolated values),
3. And to interpolate the amount of pollutants released by vehicles with an average speed of 75 kph.
III.
Methodology
To accomplish all these objectives, the program uses the following algorithm:
1. Define all preprocessor directives, functions, variables, and pointers required, #include
#include
#include double LagrangianInterpolator(double* xvalue, double*yvalue, int pointnumber, double x); int main(){ double Speed[8], CO[8], HC[8], NOx[8],