필터 지우기
필터 지우기

Optimal methods for gridding 3D velocity-data?

조회 수: 12 (최근 30일)
Jakob Sievers
Jakob Sievers 2011년 2월 16일
댓글: Umar 2024년 7월 15일 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
Umar
Umar 2024년 7월 15일 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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by