NORMSPFN normalizes the spreading function CALL: DS = normspfn(DS,thetai) DS = spreading function size nt x nf thetai = angles size nt x 1 (it also truncate negative values to zero)
Trapezoidal numerical integration. |
Extended Maximum Entropy Method | |
Iterated maximum likelihood method for estimating the directional distribution | |
maximum entropy method for estimating the directional distribution | |
maximum likelihood method for estimating the directional distribution |
001 function DS = normspfn(DS,thetai) 002 %NORMSPFN normalizes the spreading function 003 % 004 % CALL: DS = normspfn(DS,thetai) 005 % 006 % DS = spreading function size nt x nf 007 % thetai = angles size nt x 1 008 % 009 % (it also truncate negative values to zero) 010 % 011 012 nt = length(thetai); 013 ind = find(DS<0 | isnan(DS)); 014 if any(ind), 015 % disp('isnan') 016 % disp(['Negative directional distribution. Setting negative values to zero. min(DS) = ' num2str(min(DS(ind)))]) 017 DS(ind) = 0; 018 end 019 020 [ix,iy] = find(DS(:,:) ==inf); 021 if any(iy) 022 for iz = iy(:).' 023 ind0 = (DS(:,iz)<inf); 024 DS(ind0,iz) = 0; 025 DS(~ind0,iz) = 1; 026 end 027 end 028 029 %spy(DS),pause 030 031 %Normalize so that int D(theta,f) dtheta = 1 for each f 032 %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 033 %Sf2 = simpson(thetai,DS); 034 Sf2 = trapz(thetai,DS); 035 036 %plot(Sf2),pause 037 038 k = find(Sf2>sqrt(eps) & Sf2<inf); 039 if any(k) 040 DS(:,k) = DS(:,k)./Sf2(ones(nt,1),k); 041 end 042 043 return
Comments or corrections to the WAFO group