function [G]=calcg(df,t,w) % MATLAB HELP: % % function [G]=calcg(df,t,w) % % computes the coupling matrix G % % inputs % df, the time derivative of the isolation filter % t, the time grid to compute on % w, the frequencies % outputs % G, the coupling matrix % % see codes.ps for details % % aaron birch may 21 2002 % % this code calculates the % integral of df*(cos(w(i)*t)-cos(w(j)*t))/(w(i)^2-w(j)^2) % assume t evenly spaced dt=t(2)-t(1); N=length(w); G=zeros(N,N); for (i=1:N) for (j=1:N) if (w(i)~=w(j)) G(i,j)=sum(df.*(cos(w(i)*t)-cos(w(j)*t))/(w(i)^2-w(j)^2)); else % % special case of self-coupling % G(i,j)=-1*sum(df.*(t.*sin(w(i)*t)/(2*w(i)))); end; end; end; G=G*dt;