There are many instances in engineering and science where you have a data set, e
ID: 3705109 • Letter: T
Question
There are many instances in engineering and science where you have a data set, either measurements or calculations, and you have to perform some calculations on the data and plot the results. Here we will take a set of pressures calculated over the surface of an airfoil (a wing) and calculate the upward force, or lift, on the airfoil. Using MATLAB..
There is a standard set of airfoil shapes called NACA airfoils, each with a numerical designation. Here we will be using a NACA 4412 airfoil. A spreadsheet has been provided called naca4412.xlsx containing the geometry of the airfoil as x-y coordinates, and pressure coefficients calculated by the panel method at each geometric point (each x-y location) for three angles of attack, -1°, 5°, and 120. The pressure coefficients were taken from the paper Bhargava, Rao, and Dwivedi, "Pressure Distribution & Aerodynamic Characteristics of NACA Airfoils using Computational Panel Method for 2D Lifting Flow," https://www.slideshare.net/VasishtaBhargava/pressure-distribution-of-naca-airfoils-amp-aerodynamic characteristics-of-2-d-lifting-flows-computational-panel-method The spreadsheet contains 5 columns: 1. 2. 3, The x coordinates The y coordinates 1-Cp, ? =-50 5, 1-Cp, ?-120 The coordinates start at the leading edge (front) and circle the airfoil counterclockwise. A closeup of the leading-edge region with the node numbers is shown in Figure 3, where "n" is the total number of x-y coordinate pairsExplanation / Answer
Hi, The solution (MATLAB code) is given below. Since the data file is not available, I have assumed it as naca4412.xlsx . Copy the code below and save in a MATLAB script file (naca.m). Then just press the run button. That is it! You will get the plots. Rest all the explanations are given in the code as comments in the code. I have solved only till question 5 since I am not sure whether Chegg policy allows me to solve more. Feel free to ask questions in the comments section.
filename = 'naca4412.xlsx';%reading the file from the folder
A = xlsread(filename)%A will be a matrix of 5 columns with x,y and 3 Cp's
X= A(:,1);%assigning x coordinate from column1 of matrix A
Y=A(:,2);%assigning y coordinate from column2 of matrix A
cp1=A(:,3);%assigning Cp1 coordinate from column3 of matrix A
cp2=A(:,4);
cp3=A(:,5);
m=size(X);
n=m(1)
plot(X,Y)%this plots the XY coordinates
xlabel('X') % x-axis label
ylabel('Y')
title('Y vs X')
figure
subplot(2,2,1)
plot(X,cp1)
xlabel('X-axis') % x-axis label
ylabel('Cp1')
title('Cp1 vs X')
subplot(2,2,2)
plot(X,cp2)
xlabel('X-axis') % x-axis label
ylabel('Cp2')
title('Cp2 vs X')
subplot(2,2,3)
plot(X,cp3)
xlabel('X-axis') % x-axis label
ylabel('Cp3')
title('Cp3 vs X')
%Calculation of s
for i=2:n-1
s(i)=sqrt((X(i+1)-X(i-1)).^2+(Y(i+1)-Y(i-1)).^2)/2;
end
s(1)=sqrt((X(n-1)-X(2)).^2+(Y(n-1)-Y(2)).^2)/2;%calculation question 5
Completed code:
filename = 'naca.xlsx';%reading the file from the folder
A = xlsread(filename)%A will be a matrix of 5 columns with x,y and 3 Cp's
X= A(:,1);%assigning x coordinate from column1 of matrix A
Y=A(:,2);%assigning y coordinate from column2 of matrix A
cp1=A(:,3);%assigning Cp1 coordinate from column3 of matrix A
cp2=A(:,4);
cp3=A(:,5);
m=size(X);
alpha1=-5;
alpha2=1;
alpha3=12;
n=m(1)
plot(X,Y)%this plots the XY coordinates
xlabel('X') % x-axis label
ylabel('Y')
title('Y vs X')
figure
subplot(2,2,1)
plot(X,cp1)
xlabel('X-axis') % x-axis label
ylabel('Cp1')
title('Cp1 vs X')
subplot(2,2,2)
plot(X,cp2)
xlabel('X-axis') % x-axis label
ylabel('Cp2')
title('Cp2 vs X')
subplot(2,2,3)
plot(X,cp3)
xlabel('X-axis') % x-axis label
ylabel('Cp3')
title('Cp3 vs X')
%Calculation of s
for i=2:n-1
s(i)=sqrt((X(i+1)-X(i-1)).^2+(Y(i+1)-Y(i-1)).^2)/2;
end
s(1)=sqrt((X(n-1)-X(2)).^2+(Y(n-1)-Y(2)).^2)/2;%calculation question 5
for i=1:n-1
dx(i)=X(i+1)-X(i);
dy(i)=Y(i+1)-Y(i);
theta(i)=atan2(dy(i),dx(i));
CL_1(i)=cos(-pi*alpha1/180)*cp1(i)*s(i)*cos(theta(i));%alpha is in
CL_2(i)=cos(-pi*alpha2/180)*cp2(i)*s(i)*cos(theta(i));%degrees & theta
CL_3(i)=cos(-pi*alpha3/180)*cp3(i)*s(i)*cos(theta(i));%is in radians
end
%Now summing the CL's to get the total CL's
%I've made separate loops to make it more understandable
Tot_CL1=CL_1(1);%for finding the total CL1 values
Tot_CL2=CL_2(2);
Tot_CL3=CL_3(3);
for i=1:n-1
Tot_CL1=Tot_CL1+CL_1(i);%finding the total CL1 by totaling it
Tot_CL2=Tot_CL2+CL_2(i);
Tot_CL3=Tot_CL3+CL_3(i);
end
CL=[Tot_CL1 Tot_CL2 Tot_CL3];%just making an array for the plot
alpha=[alpha1 alpha2 alpha3];%make sure it is alpha, in question it is a
figure
plot(alpha,CL)%Cross check this, what's "a"? I think it's alpha
xlabel('alpha') % alpha
ylabel('CL')%CL
title('CL vs alpha')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.