Effacer les filtres
Effacer les filtres

Optimal methods for gridding 3D velocity-data?

12 vues (au cours des 30 derniers jours)
Jakob Sievers
Jakob Sievers le 16 Fév 2011
Commenté : Umar le 15 Juil 2024 à 5:32
Hi guys
I am looking for an efficient way to grid a number of 3D velocity data.
Specifically I have on the order of 1500 points for which coordinates (X,Y,Z) and velocities (U,V,W) are known. Moreover I know that all coordinates exist within a matrix, A, of size size(A)=(800,800,180) and that the top and bottom surface have velocities equal to zero. That is U(Z=1)=0 and U(Z=180)=0 (likewise for V and W).
I would like to grid these data such that the entire matrix A is filled with extrapolated/interpolated data. I have been medling around with griddata and TriScatteredInterp but have found that they require quite substantial memory and calculating time. That is if they even finish the task.
Any suggestions?
  1 commentaire
Umar
Umar le 15 Juil 2024 à 5:32

Hi Jakob,

I followed your instructions to implement the code, if you run this code based on your modifications, you will be able to effectively interpolate and extrapolate velocities for the specified points within the 3D matrix A, enabling you to visualize and analyze the velocity distribution in a structured manner.

% Define the size of the matrix A A = zeros(800, 800, 180);

% Define the known points with coordinates (X,Y,Z) and velocities (U,V,W) % For demonstration purposes, let's assume 'points' is a 1500x6 matrix points = rand(1500, 6); % Random data, replace with actual data

% Interpolate and extrapolate velocities for all points within matrix A for i = 1:size(points, 1) x = points(i, 1); y = points(i, 2); z = points(i, 3); u = points(i, 4); v = points(i, 5); w = points(i, 6);

    % Perform linear interpolation to fill matrix A with velocity data
    x_idx = round(x);
    y_idx = round(y);
    z_idx = round(z);
    % Check if the indices are within the matrix bounds
    if x_idx >= 1 && x_idx <= size(A, 1) && y_idx >= 1 && y_idx <= size(A, 2) && z_idx >= 1 && z_idx <= size(A, 3)
        A(x_idx, y_idx, z_idx) = u; % Linear interpolation for velocity 'u'
    end
end

% Display the filled matrix A disp(A);

Please see attached results.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Nonlinear Optimization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by