Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Membuat Ray Tracing:

Program untuk menentukan Csource dan Zsource :


eps = 0.00737;
c0 = 1500;
z = 0:0.1:5000;
xt = 2 * ( z - 1300 ) / 1300;
c = c0 * ( 1 + eps * ( xt - 1 + exp( -xt ) ) );
plot(c,z)
axis ij
menghasilkan grafik SVP (C,Z) :

Dari grafik SVP bisa menentukan Cs dan Zs sbb:


1. Ketika gradien negative (1508,635):

2. Ketika gradien tepat di nol (1500,1300):

3. Ketika gradien positif (1535,4000):

Program Rayf (anak program) :


function xdot = f( s, x )
% Munk sound speed profile
eps = 0.00737;
c0 = 1500;
z = x( 2 );
xt = 2 * ( z - 1300 ) / 1300;
c = c0 * ( 1 + eps * ( xt - 1 + exp( -xt ) ) );
c2 = c^2;
% we also need derivatives of sound speed
dxtdz = 2 / 1300;
cz= c0 * eps * dxtdz * ( 1 - exp( -xt ) );
cr = 0;
% here's the RHS
xdot = zeros( 4, 1 );
xdot( 1 ) = c * x( 3 );

xdot( 2 ) = c * x( 4 );
xdot( 3 ) = -cr / c2;
xdot( 4 ) = -cz / c2;

program Rays (program utama/pemanggil):


% ******************************************************
% Rays
% ******************************************************
% The equations we're solving are:
% r' = c rho
% z' = c zeta
% rho' = -c_r / c2
% zeta' = -c_z / c2
clear all
close all
send = 100000;

% arclength for rays

ntheta = 31;
% number of rays
theta = pi / 180 * linspace( -5.0,0.0, ntheta );
zs = 635.0;
c0 = 1508.00;

% source depth
% sound speed at source depth

for ith = 1:ntheta

% loop over take-off angle

% ray initial condition:


x0 = [ 0.0 zs cos( theta( ith ) ) / c0 sin( theta( ith ) ) / c0 ];
% now solve the DE to trace the ray
[ s, x ] = ode45( 'rayf', [0.0 send], x0 );
plot( x( : , 1 ), abs(x( : , 2 ) ));
% subplot(1,2,2), plot( x( : , 1 ), abs(x( : , 2 ) ));
hold on;
% hold the old rays on screen when plotting new rays
end
hold off;
% label the plot
xlabel( 'Range (m)' )
ylabel( 'Depth (m)' )
%axis([0 20000 0 140])

view( 0, -90 ); % flip plot so that z-axis is pointing down


%figure
Maka hasil Ray Tracing berdasar 3 kasus:
1. Pada gradient negative (1508,635):

2. Pada gradient nol (1500,1300):

3. Pada gradient positif (1535,4000):

You might also like