3d interpolation with interp3 and dataset .mat

1 view (last 30 days)
hi guys!
I'm developing a simulator of a rocket and.
I have a dataset called data.C_l of dimensions 14x10x9. the firsr dimension sets the Angle of attack of the rocket, the second one the velocity of it and the last one its altitude
I need to get better datas for all those points that are not given by the matrix, interpulating them.
I tried to do that with interp3, but I do not understand the meaning of the letter V in the description of the code shown by the help assistant.
this is my code:
for i1 = 1:14 % angle of attack
for i2=1:10 % Mach number
for i3=1:9 % height reached
CLinstant(n)= interp3(data.C_l(i1,:,:), data.C_l(:,i2,:), data.C_l(:,:,i3), V, Angleofattack(n), VMach(n), y(n));
CDinstant(n)= interp3(data.C_d(i1,:,:), data.C_d(:,i2,:), data.C_d(:,:,i3), V, Angleofattack(n), VMach(n), y(n));
CMinstant(n)= interp3(data.C_m(i1,:,:), data.C_m(:,i2,:), data.C_m(:,:,i3), V, Angleofattack(n), VMach(n), y(n));
end
end
end
the variable n is set in that way to get consecutive values depending on time(i need to create a 'trajectory' of the values depending on the three variables of the flight.
thank you for your constant help!

Answers (1)

Pratyush Roy
Pratyush Roy on 27 Sep 2021
Hi Luca,
The function interp3 tries to map the 3D input (X,Y,Z) to the output V = f(X,Y,Z) using a particular method (say linear, quadratic or some other kind of interpolant). After it has estimated the parameters of the interpolant it uses new values (Xq,Yq,Zq) to predict the new output Vq. To use the function interp3, we should have both the X,Y,Z as well as the V values.
Hope this helps!

Categories

Find more on Interpolation in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!