Skip to content

Commit

Permalink
Ensuring periodicity of the Green's function
Browse files Browse the repository at this point in the history
This formulation avoids redundant calculations and ensures T-periodicity of the Green's function for the grid defined over the interval [-T, T]
- With the previous formulation, in the highly over-damped cases, we obtained NaN expressions when evaluating the Green's function for negative values of t.
  • Loading branch information
jain-shobhit committed May 31, 2020
1 parent 675a4e4 commit 8cba421
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions @SSR/update_Jvec.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
function update_Jvec(O)
t1 = -O.T:O.dt:O.T; % padding Green's function to ensure correct convolution
O.Jvec = J(O,t1,O.T);
% Computing Green's function over grid [0,T]
J1 = J(O,O.t,O.T);
% Padding Green's function, i.e., using values over grid [-T,T]
% to ensure correct convolution (using the fact that the Green's function
% is T periodic)
O.Jvec = [J1(:,1:end-1) J1];
O.isupdated.J = true;
end
8 changes: 6 additions & 2 deletions @SSR/update_Lvec.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
function update_Lvec(O)
t1 = -O.T:O.dt:O.T; % padding Green's function to ensure correct convolution
O.Lvec = L(O,t1,O.T);
% Computing Green's function over grid [0,T]
L1 = L(O,O.t,O.T);
% Padding Green's function, i.e., using values over grid [-T,T]
% to ensure correct convolution (using the fact that Green's function
% is T periodic)
O.Lvec = [L1(:,1:end-1) L1];
O.isupdated.L = true;
end

0 comments on commit 8cba421

Please sign in to comment.