airfoilprediction

# airfoilprediction - A2 dzdx*cos2t*dtheta end B0 = B0/pi A1...

This preview shows pages 1–5. Sign up to view the full content.

Sheet1 clear data = load('naca4415 coordinates.txt') [m,n] = size(data) % the following stops the loop when it finds x=0 (meaning end of upper layer) Nj = 0 for i = 1:m xup(i) = data(i,1) zup(i) = data(i,2) Nj = Nj+1 if xup(i) == 0, break, end end % then we can fill in the lower layer for i = 1:Nj xlow(i) = data(Nj+i-1,1) zlow(i) = data(Nj+i-1,2) end % spline for upper layer fxup = spline(xup,zup) sup = ppval(fxup,xup) % spline for bottom layer fxlow = spline(xlow,zlow) slow = ppval(fxlow,xlow) xk = xlow for i = 0:Nj-1 zk(i+1) = .5*(zup(Nj-i) + zlow(i+1)) end s(1) = 0.0 for i = 2:Nj s(i) = s(i-1) + sqrt((xk(i)-xk(i-1))^2 + (zk(i)-zk(i-1))^2) end fx = spline(xk,zk) sk = ppval(fx,xk) % integrate c=1 B0 = 0 A1 = 0 A2 = 0 for j = 2:Nj dx = xk(j) - xk(j-1) dz = zk(j) - zk(j-1) dzdx = dz/dx thetaj = acos(1- 2*xk(j)/c) thetajm = acos(1-2*xk(j-1)/c) dtheta = thetaj - thetajm theta = . 5*(thetaj + thetajm) cost = cos(theta) Page 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 cos2t = cos(2*theta) B0 = B0 + dzdx*dtheta A1 = A1 + dzdx*cost*dtheta A2 =

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A2 + dzdx*cos2t*dtheta end B0 = B0/pi A1 = A1*2/pi A2 = A2*2/pi % alpha loop for i = 1:31 alphadeg(i) = i-11 alpha = alphadeg(i)*pi/180 A0 = alpha - B0 Cl(i) = 2*pi*(A0 + A1/2) Cm(i) = pi/4*(A2 - A1) Xcp(i) = 1/4*(1 + pi/Cl(i)*(A1 - A2)) end Xac = .25 alpha0 = B0 - A1/2 alpha0 = alpha0*180/pi % load experimental data data2 = load('naca4415 alpha vs Cl.txt') [m,n] = size(data2) for i = 1:m Clexp(i) = data2(i,2) end data3 = load('naca4415 alpha vs Cm.txt') [m,n] = size(data2) for i = 1:m Cmexp(i) = data3(i,2) end % graph figure(1) xlabel('Angle of Attack (degrees)') title('Moment Coefficient Data') figure(2) xlabel('Angle of Attack (degrees)') title('Lift Coefficient Data') figure(3) xlabel('Angle of Attack (degrees)') title('Location of Center of Pressure') Page 2 Sheet1 clear all clc Page 3 Sheet1 plot(alphadeg,Cm,alphadeg,Cmexp,'ro') ylabel('Cm') plot(alphadeg,Cl,alphadeg,Clexp,'ro') ylabel('Cl') plot(alphadeg,Xcp) ylabel('Xcp') Page 4...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern