- #1

- 250

- 0

The problem is calculating a value for a and aPrime. We're trying to use recursion to calculate the correct value for them. The way it's supposed to work:

wRelative : defined in terms of a and aPrime

phi : defined in terms of a and wRelative

alpha : defined in terms of phi

a is calculated based on an equation we were given in terms of phi

aPrime is calculated based on an equation we were given in terms of phi

We want this to recursively narrow down the value of a and aPrime until the difference between recursion cycles is negligible. However, instead of the values converging, they just alternate between 2 values (values with a fairly large difference). Can someone try and pinpoint our error? Thanks.

Note: The problem is somewhere in the section commented off between the big *PROBLEM HERE ^* and *PROBLEM HERE v* comments (there is two possible chunks). What I previously referred to as a and aPrime, are in the code as aBMT and aPrimeBMT.

Code:

```
while(aBMT < 1)% (abs(aDif) > .1) && (abs(aPrimeDif) > .1)) Finds values for a and a' such that they are within .1% of the last recursion
%*PROBLEM HERE v*
wRelative = sqrt(windSpeed^2 * (1-aBMT)^2 + (w^2*r^2) * (1 + aPrimeBMT)^2);
phiRad = asin((windSpeed * (1-aBMT))/wRelative);
phi = phiRad * (180/pi);
alpha = phi - beta;
%*PROBLEM HERE ^*
%FINDING CL
if(alpha>0 && alpha <= 8)
Cl = -0.0001*alpha^5 + 0.0016*alpha^4 - 0.0093*alpha^3 + 0.0219*alpha^2 + 0.0928*alpha + 0.0006;
elseif(alpha > 8 && alpha <= 27)
Cl = -.00001*alpha^2 + 0.0542*alpha - 0.5037;
elseif(alpha > 27 && alpha <= 90)
Cl = -.00000009*alpha^4 + .00003*alpha^3 - 0.0036*alpha^2 + 0.1761*alpha - 1.8521;
else
Cl=0;
end
%FINDING CD
if(alpha >= 0 && alpha <= 8)
Cd = -.00001*alpha^3 + 0.0003*alpha^2 - 0.0003*alpha + 0.0134;
elseif(alpha > 8 && alpha <= 90)
Cd = -.0000000004*alpha^5 + .0000002*alpha^4 - .00003*alpha^3 + 0.0018*alpha^2 - 0.0196*alpha + 0.1616;
else
Cd = 0;
end
sigma = numBlades * chord / (2 * pi * r);
%*PROBLEM HERE v*
aBMT = (1 / (1 + (4*sin(phi)^2) / (Cl * sigma * cos(phi))));
aPrimeBMT = (1 / ((4*cos(phi)) / (Cl * sigma))-1)
%*PROBLEM HERE ^*
end
```