how we can define the pulse width for the chirp signal.
I want to give the chirp signal for 0.1 micron and i have used matlab chirp inbuilt function to go from 2e6 to 7e6. But i am getting quite not convincing different plot.
% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 20; % [grid points]
PML_Y_SIZE = 10; % [grid points]
PML_Z_SIZE = 10; % [grid points]
% set total number of grid points not including the PML
Nx = 128 - 2*PML_X_SIZE; % [grid points]
Ny = 128 - 2*PML_Y_SIZE; % [grid points]
Nz = 64 - 2*PML_Z_SIZE; % [grid points]
% set desired grid size in the x-direction not including the PML
x = 40e-3; % [m]
% calculate the spacing between the grid points
dx = x/Nx; % [m]
dy = dx; % [m]
dz = dx; % [m]
% create the k-space grid
kgrid = makeGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed = 1540; % [m/s]
medium.alpha_coeff = 0.003660; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5 ;
% create the time array
[kgrid.t_array , dt] = makeTime(kgrid, medium.sound_speed);
% define a single source point
source.p_mask = zeros(Nx, Ny);
source.p_mask(end - Nx/8, Ny/2) = 1;
% define a time varying sinusoidal source
source_freq = 2e6; % [Hz]
source_mag = 1; % [Pa]
t_offset = 5e-6;
K=[2,9];
pulsewidth_min=1e-6;
for k=1:2
source.p=zeros(size(kgrid.t_array));
for i=1:200
my_chirp = chirp(kgrid.t_array(i),source_freq,kgrid.t_array(1)+pulsewidth_min,7e6)+1;
source.p(i) = source_mag*my_chirp;
end
for j=201:990
source.p(i)=0;
end
% filter the source to remove high frequencies not supported by the grid
source.p = filterTimeSeries(kgrid, medium, source.p);
% figure
% plot(kgrid.t_array,source.p)
% axis('tight')
% define a single sensor point
sensor.mask = zeros(Nx, Ny);
sensor.mask(Nx/8, Ny/K(k)) = 1;
%sensor.mask(Nx/14, Ny/7) = 1;
% define the acoustic parameters to record
sensor.record = {'p', 'p_final'};
% % run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);
% plot the final wave-field
figure;
imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data.p_final + source.p_mask + sensor.mask, [-1 1]);
colormap(getColorMap);
ylabel('x-position [mm]');
xlabel('y-position [mm]');
axis image;
% plot the simulated sensor data
figure;
[t_sc, scale, prefix] = scaleSI(max(kgrid.t_array(:)));
subplot(2, 1, 1), plot(kgrid.t_array*scale, source.p, 'b-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Input Pressure Signal');
subplot(2, 1, 2), plot(kgrid.t_array*scale, sensor_data.p, 'r-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Sensor Pressure Signal');
end