clear all format long % load the ctd file data load 'ctd_data.mat' % define the appropriate arrays for depth, pressure salinity % and temperature. Establish the arrays size as nmax. depth=ctd(:,1); p=0.1*depth; z=depth; T=ctd(:,2); S=ctd(:,3); nmax=size(depth,1); g=9.8; dens=zeros(nmax,1); E=zeros(nmax,1); N=zeros(nmax,1); for i=1:nmax dens(i)=rho(S(i),T(i),p(i)); end E(1)=-(1/dens(1))*(dens(2)-dens(1))/z(2); E(nmax)=-(1/dens(nmax))*(dens(nmax)-dens(nmax-1))/(z(nmax)-z(nmax-1)); N(1)=sqrt(g*E(1)); N(nmax)=sqrt(g*E(nmax)); for k=2:nmax-1 end