Propagation of Wave - Change Direction
2 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Abhimenyu
on 5 Apr 2024
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!
0 Comments
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!