Matlab - importing data from excel & interpolating

  • Context: MATLAB 
  • Thread starter Thread starter DyslexicHobo
  • Start date Start date
  • Tags Tags
    Data Excel Matlab
Click For Summary
SUMMARY

This discussion focuses on importing data from Excel into MATLAB for a wind turbine project, specifically for calculating lift (Cl) and drag (Cd) values using interpolation. The user currently employs a 6th degree polynomial approximation in Excel, resulting in up to 30% error. The recommended approach is to utilize MATLAB's built-in functions for data import and interpolation, which can significantly enhance accuracy. The user is advised to access MATLAB's 'Import Data' feature and consult the documentation on interpolation techniques.

PREREQUISITES
  • Basic understanding of MATLAB environment and syntax
  • Familiarity with Excel data formats and structures
  • Knowledge of interpolation methods in numerical analysis
  • Experience with polynomial functions and their applications
NEXT STEPS
  • Learn how to use MATLAB's 'Import Data' feature for Excel files
  • Explore MATLAB's 'interp1' function for one-dimensional interpolation
  • Study MATLAB's documentation on data fitting and interpolation techniques
  • Investigate error analysis methods to evaluate interpolation accuracy
USEFUL FOR

Engineers, data analysts, and researchers working on computational fluid dynamics or wind turbine performance optimization will benefit from this discussion.

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 ·
Replies
4
Views
3K
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 12 ·
Replies
12
Views
11K