function [L,gam]=loglios(th,params,Hk,k,scl,blurs) % [L,gam]=LOGLIOS(th,params,Hk,k,scl,blurs) % % Calculates the full negative logarithmic likelihood and its % derivatives, i.e. minus LKOS and minus GAMMAKOS averaged over % wavenumber space. This is the function that we need to MINIMIZE! % % INPUT: % % th The five-parameter vector argument [scaled]: % th(1)=D Isotropic flexural rigidity % th(2)=f2 The sub-surface to surface initial loading ratio % th(3)=s2 The first Matern parameter, aka sigma^2 % th(4)=nu The second Matern parameter % th(5)=rho The third Matern parameter % params A structure with AT LEAST these constants that are known: % DEL surface and subsurface density contrast [kg/m^3] % g gravitational acceleration [m/s^2] % Hk A complex matrix of Fourier-domain observations % k the wavenumbers at which these are being evaluated [1/m] % scl The vector with any scalings applied to the parameter vector % blurs 1 Blur using the spectral window [default] % 0 Don't blur using the spectral window % % OUTPUT: % % L The loglihood, averaged over all wavenumbers % gam The score, averaged over all wavenumbers % % SEE ALSO: % % FISHERKOS, which should be incorporated at a later stage % % Last modified by fjsimons-at-alum.mit.edu, 4/21/2011 % Default scaling is none defval('scl',ones(size(th))) defval('blurs',1) % Scale up the parameter vector for the proper likelihood and score th=th.*scl; % The NaN's will be in here at zero wavenumber % Note: should we restrict this to the upper halfplane? or will mean do % Get the likelihood at the individual wavenumbers; average L=-nanmean(Lkos(k,th,params,Hk,blurs)); % Get the scores at the individual wavenumbers; average %gam=-nanmean(gammakos(k,th,params,Hk)); % The correct gradient is too heterogeneous to be good so scale %gam=gam.*scl; gam=NaN; % Print the trajectory, seems like one element at a time gets changed % disp(sprintf('Current theta: %8.3g %8.3g %8.3g %8.3g %8.3g',th))