Professional Documents
Culture Documents
KL3104
Task 0…
% ******************************************************
% Rays
% ******************************************************
%figure
PROGRAM SVP_TB.m
%clear all
%close all
% [A,B] = XLSREAD('suh01_sound_speed_vs_depth','SUH01');
[A,B] = xlsread('test.xls','geo144');
[P,S] = polyfit(D,C,6);
C6 = P(1)*D.^6+P(2)*D.^5+P(3)*D.^4+P(4)*D.^3+P(5)*D.^2+P(6)*D.^1+P(7)*D.^0;
save test6.txt P -ASCII
[P,S] = polyfit(D,C,5);
C5 = P(1)*D.^5+P(2)*D.^4+P(3)*D.^3+P(4)*D.^2+P(5)*D.^1+P(6)*D.^0;
save test5.txt P -ASCII
[P,S] = polyfit(D,C,12);
C12 =
P(1)*D.^12+P(2)*D.^11+P(3)*D.^10+P(4)*D.^9+P(5)*D.^8+P(6)*D.^7+P(7)*D.^6+P(8)*D.^5+P(9)*D.^4+P(10)*
D.^3+P(11)*D.^2+P(12)*D.^1+P(13)*D.^0;
save test12.txt P -ASCII
% Plot C1 vs d
subplot(1,2,1), plot(C,D,'o',C12,D,'r',C5,D,'g',C6,D,'k')
% figure(1)
% subplot(1,2,1), plot(C,D,'o',C6,D,'k')
axis ij
xlabel('Sound Speed, C (m/s)')
ylabel('Depth, D (m)')
legend('Data','N=12','N=5','N=6',4)
PROGRAM empiris_equation.m
%clear all
%close all
% [A,B] = XLSREAD('suh01_sound_speed_vs_depth','SUH01');
[A,B] = xlsread('test.xls','geo144');
% Plot T vs D
% figure
subplot(1,3,1), plot(T,D)
axis ij
xlabel('Temperatur, T (^oC)')
ylabel('Depth, D (m)')
% Plot S vs D
%figure
subplot(1,3,2),plot(S,D)
axis ij
xlabel('Salinitas, S (ppt)')
ylabel('Depth, D (m)')
% Plot C vs D
% figure
subplot(1,3,3),plot(C,D,'k',C_Medwin,D,'r',C_Leroy,D,'g',C_Mckenzie,D,'b')
axis ij
xlabel('Sound Speed, C (m/s)')
ylabel('Depth, D (m)')
% legend('Data','Medwin')
legend('Data','Medwin','Leroy','Mckenzie')
figure(2)
plot(C,D,'k',C_Medwin,D,'r',C_Leroy,D,'g',C_Mckenzie,D,'b')
axis ij
xlabel('Sound Speed, C (m/s)')
ylabel('Depth, D (m)')
legend('Data','Medwin','Leroy','Mckenzie')
PROGRAM RAYF_xx.m
function xdot = f( s, x )
% eps = 0.00737;
%c0 = 1500;
z = x( 2 );
% xt = 2 * ( z - 1300 ) / 1300;
% c = c0 * ( 1 + eps * ( xt - 1 + exp( -xt ) ) );
load test6.txt
P = test6;
D=z;
c = P(1)*D.^6+P(2)*D.^5+P(3)*D.^4+P(4)*D.^3+P(5)*D.^2+P(6)*D.^1+P(7)*D.^0;
c2 = c^2;
% dxtdz = 2 / 1300;
% cz= c0 * eps * dxtdz * ( 1 - exp( -xt ) );
cz = 6*P(1)*D.^5+5*P(2)*D.^4+4*P(3)*D.^3+3*P(4)*D.^2+2*P(5)*D.^1+P(6)*D.^0;
cr = 0;
xdot = zeros( 4, 1 );
xdot( 1 ) = c * x( 3 );
xdot( 2 ) = c * x( 4 );
xdot( 3 ) = -cr / c2;
xdot( 4 ) = -cz / c2;
Figure 1 Empiris Equation 1
Figure 3 SVP_TB
Figure 4 Rays