Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. function A = coef(alpha)
  2. % Do not change the function name, number of input and output variables.
  3. % In this function you have to calculate the coef. A0 to A20 using integrations.
  4. % The input is only the angle of attack in radian, and the output is a vector array
  5. % with 21 elements. The first element is A0, and the last element is A20.
  6. % Note that this function and dcamber do not need the chord length.
  7. theta = 0:pi()/21:pi();
  8. A = zeros(21,1);
  9. dzdx = @(theta) dcamber(theta);
  10. A(1) = alpha - 1/pi*integral(dzdx, 0, pi);
  11. for i = 1:1:20
  12. fun2 = @(theta2) dcamber(theta2).*cos(i.*theta2);
  13. A(i+1) = 2/pi*integral(fun2, 0, pi);
  14. end
  15.  
  16. % Write a loop that goes over the calculation of each element of A using the dz/dx
  17. % defined in dcamber function.
  18. % Remember that some functions are defined using the auxiliary variable theta, and
  19. % some are based on x/c and z/c.
  20. % Use any integration method you like. But, you may need to increase the accuracy
  21. % to be able to generate the same coef. as the reference code.
  22. end
  23.  
  24. function dzdx = dcamber(theta)
  25. xc = (1/2) .* (1-cos(theta))
  26. zc = zeros(1,21);
  27. i=1;
  28. while xc(i)<=0.2025
  29. zc(i) = 2.6595*xc(i)*(xc(i)^2 - 0.6075*xc(i) + 0.1147);
  30. i = i+1;
  31. end
  32. while i<=21
  33. zc(i) = 0.02208*(1-xc(i));
  34. i = i+1;
  35. end
  36. dzdx = zeros(1,21);
  37. i=1;
  38. while xc(i)<=0.2025
  39. dzdx(i) = (2.6595*(3*(xc(i)^2) - 1.2150*xc(i) + 0.1147));
  40. i = i+1;
  41. end
  42. while i<=21
  43. dzdx(i) = -0.02208;
  44. i = i+1;
  45. end
  46. % write a function that calculates dz/dx for each value of theta. You may want to
  47. % create a function that works with a vector array as theta and generates a vector
  48. % array dzdx corresponding to each element of input.
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement