Global Index (short | long) | Local contents | Local Index (short | long)
This buffer is for notes you don't want to save, and for Lisp evaluation. If you want to create a file, visit that file with C-x C-f, then enter the text in that file's own buffer. call randominit(dt,1.39e-4) subroutine randominit (dt,dcoef) c c Given the timestep size "dt" and rolloff frequency "dcoef", c this function provides a low-pass filtered white noise time c series for ramdomly forcing the shallow water model. c dt = 7200. seconds real*8 ddt,ddcoef,dranold,drannew,coef1,coef2 c ddt=dt ddcoef=dcoef dranold=0. coef1=(1.0-0.5*ddt*ddcoef)/(1.0+0.5*ddt*ddcoef) coef2=ddt/(1.0+0.5*ddt*ddcoef) iseed=9385729 c return c entry randomwind (rannew) c drannew = coef1*dranold+coef2*(ran(iseed)-0.5) c dranold=drannew rannew=drannew c return ndays = 1; ddcoef = 1/(7200.*12*ndays); dranold=0. coef1=(1.0-0.5*ddt*ddcoef)/(1.0+0.5*ddt*ddcoef) coef2=ddt/(1.0+0.5*ddt*ddcoef) drannew = zeros(1, 100000); for i = 1:100000; drannew(i) = coef1*dranold+coef2*(rand(1)-0.5); dranold = drannew(i); end [h, f] = spectrum(drannew, 5000, 2500); f = 6*f; plot(log(f), f.*h(:,1)); xt = [128 64 32 16 8 4 2 1 0.5 0.25]; set(gca, 'XTick', log(1./xt), 'XTickLabel', xt); title(['NDAYS = ' num2str(ndays)]);