Hi,
Can anyone tell me how to define source.p as a matrix? I load the image and get the source.p0 as a matrix.But i don't know how to define source.p as a martix with the same size as source.p0.
p0_magnitude = 1;
p0 = p0_magnitude * loadImage('150mev.png');
% create the computational grid
Nx = 128; % number of grid points in the x (row) direction
Ny = 128; % number of grid points in the y (column) direction
dx = 0.1e-3; % grid point spacing in the x direction [m]
dy = 0.1e-3; % grid point spacing in the y direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy);
% resize the image to match the size of the computational grid and assign
% to the source input structure
source.p0 = resize(p0, [Nx, Ny]);
% define the properties of the propagation medium
medium.sound_speed = 1500; % [m/s]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
% define a time varying sinusoidal source
source_freq = 0.25e6; % [Hz]
for i = 1:128 %
for k = 1:128
source.mag = source.p0(i,k) %
source.p = source.mag * sin(2 * pi * source_freq * kgrid.t_array);
end
end % [Pa]
% filter the source to remove high frequencies not supported by the grid
source.p = filterTimeSeries(kgrid, medium, source.p);