acoustic wave propagation underwater in matlab

To simulate acoustic wave propagation underwater in MATLAB, you can use the parabolic wave equation (PWE), which is a commonly used technique for underwater acoustic modeling. The PWE is based on the assumption that the wave fronts are parallel to the surface of the Earth, and that the wave is propagating in the vertical direction.

Here's an example code snippet to get started with using the PWE method in MATLAB:

main.m
% Define simulation parameters
dx = 1; % grid spacing in meters
dz = 1; % depth spacing in meters
dt = 1e-4; % time step in seconds
f = 1000; % frequency in Hz
c0 = 1500; % sound speed in m/s
rho = 1000; % water density

% Create 2D grid
x = 0:dx:1000;
z = 0:dz:1000;
[X, Z] = meshgrid(x, z);

% Define source frequency and location
source_freq = 1000; % Hz
source_location = [500, 500]; % meters

% Calculate sound speed profile in water
S = ones(size(X))*c0; % constant sound speed
for k=1:10
    zc = (k-0.5)*100;
    S = S + 100*sin(2*pi*source_freq/c0*(Z-zc));
end

% Define initial pressure field
P = zeros(size(X)); % zero initial pressure
P_prev = P; % previous pressure field

% Main loop for time stepping
for t=1:10000
    % Compute spatial derivatives of pressure field
    dPdx = (P - circshift(P, [0, -1])) / dx;
    dPdz = (P - circshift(P, [-1, 0])) / dz;
    
    % Compute temporal derivative of pressure field
    dPdt = (P - P_prev) / dt;
    
    % Apply the parabolic wave equation
    P_next = 2*P - P_prev + (c0^2/rho)*(dt^2)*(dPdx.^2 + dPdz.^2) - (c0^2/rho)*dt^2*dPdt;
    
    % Apply the source
    P_next(source_location(1), source_location(2)) = P_next(source_location(1), source_location(2)) + sin(2*pi*f*t*dt);
    
    % Update the pressure field
    P_prev = P;
    P = P_next;
end

% Plot the final pressure field
imagesc(x, z, P');
colorbar;
title('Acoustic Pressure Field');
xlabel('Horizontal Distance (m)');
ylabel('Depth (m)');
1467 chars
55 lines

This code creates a grid, calculates the sound speed profile based on a single-frequency wave, then applies the parabolic wave equation to simulate the propagation of the wave over time. The code also applies a sin wave source at a specified location in the water.

Note: this is a basic example, and more advanced models may include additional features such as reflection, refraction, and environmental variability.

gistlibby LogSnag