x = [0 400  ; 0   400];
y = [0 0    ; 400 400];
z = [-10 2  ; -10   2];

for n = [1 3 5]
    for a = [0 10 20]
        
        xbm = xb_generate_model( ...
            'bathy',{'x' x 'y' y 'z' z 'rotate' false 'finalise' {'seaward_extend'}}, ...
            'waves',{'Hm0' 3 'Tp' 6 's' 10000 'mainang' 270+a}, ...
            'wavegrid',{'nbins' n}, ...
            'tide',{'front' 0 'back' 0}, ...
            'settings',{'morphology' 0 'sedtrans' 0 'random' 0 'epsi' -1 'outputformat' 'netcdf' ...
                'globalvars' {'H' 'zs' 'zb' 'Fx' 'Fy' 'Sxx' 'Syy' 'Sxy' 'thetamean'} ...
                'meanvars' {'H' 'Fx' 'Fy' 'thetamean'}});

        run = sprintf('%1dbin_alpha%02d', n, a);
        
        disp(run);
        
        if ~exist(run,'dir')
            mkdir(run);
        end
        
        xb_write_input(fullfile(run,'params.txt'),xbm);
    end
end