Propagation of Wave - Change Direction

5 次查看(过去 30 天)
Hello!
I have a 3D array modeling a pressure source that propogates in the z-direction. I wish to keep my original source, but change axes so that the source propogates in the x-direction. I have tried the permute and imrotate3 functions, to no avail. Is there a better way to do this? I have attached my 3d array for reference.
Thank you in advance!

回答(1 个)

Abhimenyu
Abhimenyu 2024-4-5
Hi Zachary,
From the information shared, I inferred that there is a 3D array modeling a pressure source that propagates in the z-direction and now you want it to propagate in the x-direction. Let’s assume the original 3D array is denoted as P(z,y,x). Wave propagation can be easily used to transform this array into a new array P_new(x,y,z) to change the propagation direction to the x-axis as demonstrated in the below-mentioned example MATLAB code:
% Assuming P is your original 3D array : P(z,y,x)
[z_dim, y_dim, x_dim] = size(P);
% Initialize the new array
P_new = zeros(x_dim, y_dim, z_dim);
% Copy values from P to P_new
for z = 1:z_dim
for y = 1:y_dim
for x = 1:x_dim
P_new(x, y, z) = P(z, y, x);
end
end
end
% Now P_new represents the pressure source propagating in the x-direction
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by