%% Simple plot of the model %% This plot adds elements to current figure %% %% Add to this code color plotting of velocities using 'imagesc()' %% ====================================================================================== %% %% Parameters: %% model - the model structure as described in code 'trace_ray' %% slowness - slowness vector corresponding to the model. %% The slowness is plotted as VELOCITY values, by using imagesc(). %% If this parameter is not given, velocity is not plotted function p = plot_model(model,slowness) hold on % lower-right corner of the model lr = model.xz0 + [ model.nx*model.dxz(1), model.nz*model.dxz(2) ]; % generate grids of X and Y coordinates at the edges of the cells x = model.xz0(1) + model.dxz(1)*(0:model.nx); z = model.xz0(2) + model.dxz(2)*(0:model.nz); % plot velocities in color if nargin > 1 % slowness vector is given vgrid = vect2grid(model,slowness).^(-1); caxis([1.5, 3]); imagesc(x(2:end) - 0.5*model.dxz(1),z(2:end)- 0.5*model.dxz(2),vgrid); colorbar endif % horizontal lines for i=1:length(z) plot([model.xz0(1), lr(1)], [z(i),z(i)],'k-'); end % vertical lines for i=1:length(x) plot([x(i),x(i)],[model.xz0(2), lr(2)],'k-' ); end xlabel('X (m)') ylabel('Depth (m)') end