Hi,

For simplicity I tried to measure the frequency response in free field and the same type of output is coming i.e low frequency are getting attenuated more compared to high frequency. Below is the code for that. Could you please let me know if there is something wrong with code or is there any reasoning behind this?

% create the computational grid

Nx = 256; % number of grid points in the x (row) direction

Ny = 256; % 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);

% define the properties of the propagation medium

medium.sound_speed_compression = 334 * ones(Nx, Ny); % [m/s]

medium.sound_speed_shear = zeros(Nx, Ny); % [m/s]

medium.density = 1.225 * ones(Nx, Ny); % [kg/m^3]

% create the time array

cfl = 0.1; % Courant-Friedrichs-Lewy number

t_end = 1e-4; % [s]

kgrid.makeTime(max(medium.sound_speed_compression(:)), cfl, t_end);

%Define source

source.s_mask=zeros(Nx,Ny);

source.s_mask(Nx/2,Ny/2)=1;

f1=1e5; %Hz

f2=5e5;

source.sxx=sin(2*pi*f1*kgrid.t_array)+sin(2*pi*f2*kgrid.t_array);

source.syy=sin(2*pi*f1*kgrid.t_array)+sin(2*pi*f2*kgrid.t_array);

% define sensor

sensor.mask = zeros(Nx,Ny);

sensor.mask(Nx/4,Ny/2)=1;

sensor.record={'p','p_rms','I_avg'};

% define a custom display mask showing the position of the interface from

% the fluid side

display_mask = false(Nx, Ny);

% display_mask(Nx/2 - 1, :) = 1;

% define input arguments

input_args = {'PlotScale',[-1.5 1.5], 'PlotPML', false,...

'DisplayMask', display_mask, 'DataCast', 'single','Shear',false};

% run the simulation

sensor_data = pstdElastic2D(kgrid, medium, source, sensor, input_args{:});

sensor_data_reordered = reorderSensorData(kgrid, sensor, sensor_data);

% =========================================================================

% VISUALISATION

% =========================================================================

% plot source and sensor data: Time and Frequency

figure;

[t_sc, scale, prefix] = scaleSI(max(kgrid.t_array(:)));

subplot(2, 2, 1);

plot(kgrid.t_array * scale, source.sxx, 'k-');

xlabel(['Time [' prefix 's]']);

ylabel('Signal Amplitude');

axis tight;

title('Input Pressure Signal');

L=length(source.sxx);

fs=1/kgrid.dt;

t=kgrid.t_array; dt=kgrid.dt;

sc=fs/L;

source_freq=fft(source.sxx,L)*dt;

f=(fs/2)*linspace(0,1,L/2+1); %Frequency Range

amp=2*sc*abs(source_freq(1:L/2+1)); %Single sided spectrum

subplot(2,2,3);

plot(f,amp);

subplot(2, 2, 2);

plot(kgrid.t_array * scale, sensor_data_reordered.p, 'r-');

xlabel(['Time [' prefix 's]']);

ylabel('Signal Amplitude');

axis tight;

title('Sensor Pressure Signal');

L=length(sensor_data.p);

sc=fs/L;

sensor_freq=fft(sensor_data.p,L)*dt; %% fourier transform of data

f=(fs/2)*linspace(0,1,L/2+1); % frequency range

amp=2*sc*abs(sensor_freq(1:L/2+1)); % Single sided spectrum

subplot(2,2,4);

plot(f,amp);

xlabel('Frequecny [Hz]');

ylabel('Signal Amplitude');

axis tight;

title('Sensor frequency');

Thanks