Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function A = coef(alpha)
- % Do not change the function name, number of input and output variables.
- % In this function you have to calculate the coef. A0 to A20 using integrations.
- % The input is only the angle of attack in radian, and the output is a vector array
- % with 21 elements. The first element is A0, and the last element is A20.
- % Note that this function and dcamber do not need the chord length.
- theta = 0:pi()/21:pi();
- A = zeros(21,1);
- dzdx = @(theta) dcamber(theta);
- A(1) = alpha - 1/pi*integral(dzdx, 0, pi);
- for i = 1:1:20
- fun2 = @(theta2) dcamber(theta2).*cos(i.*theta2);
- A(i+1) = 2/pi*integral(fun2, 0, pi);
- end
- % Write a loop that goes over the calculation of each element of A using the dz/dx
- % defined in dcamber function.
- % Remember that some functions are defined using the auxiliary variable theta, and
- % some are based on x/c and z/c.
- % Use any integration method you like. But, you may need to increase the accuracy
- % to be able to generate the same coef. as the reference code.
- end
- function dzdx = dcamber(theta)
- xc = (1/2) .* (1-cos(theta))
- zc = zeros(1,21);
- i=1;
- while xc(i)<=0.2025
- zc(i) = 2.6595*xc(i)*(xc(i)^2 - 0.6075*xc(i) + 0.1147);
- i = i+1;
- end
- while i<=21
- zc(i) = 0.02208*(1-xc(i));
- i = i+1;
- end
- dzdx = zeros(1,21);
- i=1;
- while xc(i)<=0.2025
- dzdx(i) = (2.6595*(3*(xc(i)^2) - 1.2150*xc(i) + 0.1147));
- i = i+1;
- end
- while i<=21
- dzdx(i) = -0.02208;
- i = i+1;
- end
- % write a function that calculates dz/dx for each value of theta. You may want to
- % create a function that works with a vector array as theta and generates a vector
- % array dzdx corresponding to each element of input.
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement