Hi ,
We tried running following code ( given K-Wave documentation ) for simulating a monopole point source in a homogenous propogation medium we got the simulation running but we have not been able to get a graph between signal amplitude and time , also we were looking to plot a graph between signal amplitude and sensor pressure signal .
Would you please help us in plotting the same ? ( What should we add , to our code to get the desired plot )
% creating a computatuional grid
Nx = 128;
Ny = 128;
Nz = 128;
dx = .1*10^-3;
dy = .1*10^-3;
medium.sound_speed = 1500;
medium.alpha_coeff = .75;
medium.alpha_power = 1.5;
kgrid = makeGrid(Nx,dx,Ny,dy);
t_end = 6*10^-6;
kgrid.t_array = makeTime(kgrid,medium.sound_speed,[],t_end);
source.p_mask = zeros(Nx,Ny);
source.p_mask(end - Nx/4,Ny/2) =1;
source_freq = 0.25*10^6;
source_mag = 2;
source.p = source_mag*sin(2*pi*source_freq*kgrid.t_array);
source.p = filterTimeSeries(kgrid,medium,source.p);
sensor_radius = 4*10^-3;
num_sensor_points = 50;
sensor.mask = makeCartCircle(sensor_radius,num_sensor_points);
sensor.record = {'p','p_final'};
sensor_data = kspaceFirstOrder2D(kgrid,medium,source,sensor);
k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
Graphing data ( Monopole source in the homogenous propagation medium )
(4 posts) (4 voices)-
Posted 9 years ago #
-
Hi Suryakant,
You could use something like:
figure; plot(kgrid.t_array, sensor_data.p); xlabel('Time'); ylabel('Pressure');
There are also lots of examples in the html help included with k-Wave. See section 1.3 of the k-Wave manual for how to access this in different versions of MATLAB.
Brad.
Posted 9 years ago # -
Hi,
I am brand new at this...and trying to run an example (Any example), but keep getting the same error: Undefined function 'makeGrid' for input arguments of type 'double'.
Where am I going wrong?thanks!
Posted 9 years ago # -
Hi Caroline,
The toolbox is probably not in your Matlab path.
If the toolbox is in 'C:\MATLAB\R2015a\toolbox\k-Wave Toolbox 1.1' for example.
Then do:
addpath(genpath('C:\MATLAB\R2015a\toolbox\k-Wave Toolbox 1.1'));
and try to run the code again.Anthony
Posted 9 years ago #
Reply
You must log in to post.