File for adv_graph.txt is located at this link: https://www.4shared.com/office/s
ID: 3812485 • Letter: F
Question
File for adv_graph.txt is located at this link: https://www.4shared.com/office/sm8j0fMAca/adv_graph.html
Let me know if the link does not work, or if you know of a better file sharing site.
2. The experimental data from a wind tunnel test has been saved to a file called adv graph.txt. This file contain performance characteristics for an airfo it lists velocity (ft/s), Reynolds number, angle of attack (deg), lift coefficient, pressure drag coefficient and moment coefficient, respectively. Plot the Lift coefficient vs angle of attack on the left axis and Moment Coefficient vs angle of attack on the right axisExplanation / Answer
# Since you have not specified which program to code in, I am assuming it to be irrelavant and therefore coding in python
import re;
import numpy as np
import matplotlib.pyplot as plt
velocity = []
reynoldNum = []
angleOfAttack = []
liftCoefficient = []
dragCoefficient = []
momentumCoefficient = []
fileInstance = open("adv_graph.txt",'r');
fileText = fileInstance.read();
recordSplits = fileText.split(" ");
for record in recordSplits :
if record == "" :
continue;
wordSplits = re.split(" | ", record.strip());
newData = [];
for word in wordSplits :
if word.strip() == "" :
continue
newData.append(word.strip());
velocity.append(float(newData[0].strip()));
reynoldNum.append(float(newData[1].strip()));
angleOfAttack.append(float(newData[2].strip()));
liftCoefficient.append(float(newData[3].strip()));
dragCoefficient.append(float(newData[4].strip()));
momentumCoefficient.append(float(newData[5].strip()));
fig, left_axis = plt.subplots();
right_axis = left_axis.twinx();
left_axis.plot(angleOfAttack, liftCoefficient, 'g-');
right_axis.plot(angleOfAttack, momentumCoefficient, 'b-');
left_axis.set_xlabel('Angle Of Attack')
left_axis.set_ylabel('Lief Coefficient', color='g')
right_axis.set_ylabel('Momentum Coefficient', color='b')
plt.show();
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.