- #1
DyslexicHobo
- 251
- 0
I have data that I'm using for a wind turbine project. The project requires that I retrieve data from an excel sheet that was supplied of experimentally tested values for lift and drag. These values for lift and drag are based on a value alpha (an angle, but irrelevant to the coding question).
Right now, I have used Excel's line of best fit approximation (using a 6th degree polynomial) along with different if statements to get the values, but I've found that there can be up to 30% error in some calculations. Instead, I'd like to import the data to excel and use Matlab's interpolate function to find these values.
The only problem is... I have no clue how to go about importing the data to excel or how to use the interpolate function. My Matlab experience is literally non-existent. I have minor experience in Java but that's it.
What's the easiest way to import the data from excel, and what functions can I use to interpolate the data? Thanks!
Here's the code I'm trying to replace:
Right now, I have used Excel's line of best fit approximation (using a 6th degree polynomial) along with different if statements to get the values, but I've found that there can be up to 30% error in some calculations. Instead, I'd like to import the data to excel and use Matlab's interpolate function to find these values.
The only problem is... I have no clue how to go about importing the data to excel or how to use the interpolate function. My Matlab experience is literally non-existent. I have minor experience in Java but that's it.
What's the easiest way to import the data from excel, and what functions can I use to interpolate the data? Thanks!
Here's the code I'm trying to replace:
Code:
%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