Linear Interpolation. The following problem refer to the wind-tunnel test data s
ID: 3681920 • Letter: L
Question
Linear Interpolation. The following problem refer to the wind-tunnel test data stored in the file tunnel.dat (contents are below). The file contains the set of data which consists of a flight-path angle (in degrees) and its corresponding coefficient of lift on each line in the file. The flight-path angles will be in ascending order. Write a program that reads the wind-tunnel test data and then allows the user to enter a flight-path angle. If the angle is within the bounds of the data set, the program should then use linear interpolation to compute the corresponding coefficient of lift. Utilize function and arrays in yours answer.Explanation / Answer
Program returns "inf" instead of actual value
So, I've been assigned to write a program that reads the wind-tunnel test data, that of which is called the "tunnel.dat" in my program, and then allows the user to enter a flight-path angle. If the angle entered is within the bounds of the data set, the program would need to do linear interpolation to compute the corresponding coefficient of lift, given by
f_b = f_a + ((b-a)/(a-c)) * (f_c - f_a)
The problem I'm having is that the program has successfully compiled, however the result isn't turning out as it should be. It's returning "The coefficient of lift is inf." where it should be a value given and computed from the arrays. The loop doesn't stop, or I mean that the program continues running even though it has returned "inf".
I'm not sure where my problem stands because my function seems to be correct, but any helpful input would be great, thank you :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.