How to Perform 3D Interpolation in MATLAB?

In summary: Your Name] In summary, the conversation discusses using the MATLAB interp2 function to interpolate thrust values for a given velocity using altitude and temperature data. The code provided in the conversation can be used within an external loop to obtain a 51x51 thrust matrix.
  • #1
FutureScience
10
0
Hello everybody!

I'm dealing with a MATLAB script that is made up in this way:

I've this external loop

Code:
% ALTITUDE [ft]
h_ft = 0:200:10000;

% TEMPERATURE [°C]
T_C = 0:1:50;

for mm = 1:length(h)
    for nn = 1:length(T_0)

The aim of this loop is to calcuate a velocity, so at the end I obtain a V_0 of dimension 51x51.

I want to use this V_0 velocity to enter in a matrix where I've other altitude and temperature intervals, which are h_new = 0:1000:10000 and T_new = 0:5:50, and for a velocity vector V_T = 0:13.26:106.08 [m/s], I have the thrust values that you see in this picture:
http://img249.imageshack.us/img249/2285/image1ii.jpg
(Imagine a similar matrix for the other altitude values)

So for any iteration of the external loop, I want to enter with the previously calculated V_0 in the V_T range, and for each value of h_ft and T_0, which have different sizes compared with h_new and T_new, I want the corresponding thrust values for my V_0.

In the end I want to obtain a 51x51 thrust matrix, by interpolating h_new and T_new values, to find the ones for h_ft and T_0.

I've struggled with both interp2 and griddata, without much success, so I'm asking for your help!

Thanks in advance!
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


Hello there,

Thank you for sharing your question with us. It seems like you are trying to interpolate values for thrust based on altitude and temperature using a given velocity. This can be achieved using the interp2 function in MATLAB.

First, you will need to organize your data into a grid format, with altitude as the rows and temperature as the columns. Then, you can use the interp2 function to interpolate the thrust values for the given velocity. Here's an example code:

% Define the grid for altitude and temperature
h_new = 0:1000:10000;
T_new = 0:5:50;

% Define the thrust values matrix for the given grid
thrust = [0 20 40 60 80 100 120 140 160 180;
10 30 50 70 90 110 130 150 170 190;
20 40 60 80 100 120 140 160 180 200;
30 50 70 90 110 130 150 170 190 210;
40 60 80 100 120 140 160 180 200 220;
50 70 90 110 130 150 170 190 210 230;
60 80 100 120 140 160 180 200 220 240;
70 90 110 130 150 170 190 210 230 250;
80 100 120 140 160 180 200 220 240 260;
90 110 130 150 170 190 210 230 250 270;
100 120 140 160 180 200 220 240 260 280];

% Define the velocity for which you want to interpolate
V_0 = 30;

% Use interp2 to interpolate the thrust values for the given velocity
thrust_interpolated = interp2(h_new, T_new, thrust, V_0);

% Display the interpolated thrust values
disp(thrust_interpolated);

You can use this code within your external loop to obtain a 51x51 thrust matrix. I hope this helps. Let me know if you have any further questions.

 

1. What is 3D interpolation in Matlab?

3D interpolation in Matlab is a mathematical process that involves estimating values for points in a three-dimensional space based on existing data points. It is commonly used in scientific and engineering fields to fill in missing data or create a smooth surface from scattered data points.

2. What are the benefits of using 3D interpolation in Matlab?

3D interpolation in Matlab allows for the creation of a continuous surface from scattered data points, which can help in visualizing and analyzing complex data sets. It also allows for the filling in of missing data points, which can improve the accuracy and reliability of data analysis.

3. How does 3D interpolation in Matlab work?

3D interpolation in Matlab works by using mathematical algorithms to estimate values for points in a three-dimensional space based on surrounding data points. It uses a combination of linear and nonlinear interpolation methods to create a smooth surface that accurately represents the data.

4. What types of data are suitable for 3D interpolation in Matlab?

3D interpolation in Matlab is suitable for any type of data that can be represented in three-dimensional space, such as temperature, pressure, or velocity data. It is commonly used in fields such as meteorology, geology, and fluid dynamics.

5. Are there any limitations to using 3D interpolation in Matlab?

One limitation of 3D interpolation in Matlab is that it requires a sufficient amount of data points to accurately estimate values for the entire surface. It may also not be suitable for highly irregular or unpredictable data sets. Additionally, the accuracy of the interpolation may be affected by the type of interpolation method used and the spacing of the data points.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
30K
Back
Top