MATLAB Matlab - importing data from excel & interpolating

  • Thread starter Thread starter DyslexicHobo
  • Start date Start date
  • Tags Tags
    Data Excel Matlab
AI Thread Summary
The discussion centers on a wind turbine project requiring the retrieval of lift and drag values from an Excel sheet containing experimentally tested data. The user currently relies on a 6th degree polynomial for approximations but faces significant errors in calculations, prompting a desire to utilize MATLAB's interpolation functions for improved accuracy. The user seeks guidance on importing data from Excel into MATLAB and using interpolation functions, noting their lack of MATLAB experience and limited programming background. Recommendations include using MATLAB's 'Import Data' feature to load the Excel file and consulting the help browser for detailed information on interpolation methods. This approach aims to enhance the accuracy of lift and drag calculations in the project.
DyslexicHobo
Messages
249
Reaction score
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:
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
 
Physics news on Phys.org
DyslexicHobo said:
What's the easiest way to import the data from excel,

Locate your data file in Matlab's 'Current Directory' window. Right-click on the file and select 'Import Data'. The use the GUI to import the data into matlab.

DyslexicHobo said:
and what functions can I use to interpolate the data? Thanks!

Matlab's documentation discusses interpolation and fitting at great length. Use the help browser to search for 'Interpolation'.
 

Similar threads

Replies
4
Views
3K
Replies
4
Views
5K
Replies
1
Views
3K
Replies
1
Views
3K
Back
Top