From a8f694e19c6938201d14620dd5afc689cbdaeeb3 Mon Sep 17 00:00:00 2001 From: Khalid Gameil Date: Tue, 19 Apr 2016 10:30:48 -0400 Subject: [PATCH] Changes the settings in the file CurrentCode.m so SimType is set to 'c' and I commented lines 122-139 and replaced with the gradient function -Khalid Gameil --- CondCode/CurrentCode.m | 2 +- CondCode/GetCurrents.m | 38 ++++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CondCode/CurrentCode.m b/CondCode/CurrentCode.m index ef8f748..9afef0c 100644 --- a/CondCode/CurrentCode.m +++ b/CondCode/CurrentCode.m @@ -22,7 +22,7 @@ Acond = 1; Bcond = 10; -SimType = 'e'; +SimType = 'c'; Max = 5; ncircs = 20; diff --git a/CondCode/GetCurrents.m b/CondCode/GetCurrents.m index f17c442..1ba89c3 100644 --- a/CondCode/GetCurrents.m +++ b/CondCode/GetCurrents.m @@ -119,24 +119,26 @@ end end -for i = 1:nx - for j = 1:ny - if i == 1 - Ex(i, j) = (Vmap(i + 1, j) - Vmap(i, j)); - elseif i == nx - Ex(i, j) = (Vmap(i, j) - Vmap(i - 1, j)); - else - Ex(i, j) = (Vmap(i + 1, j) - Vmap(i - 1, j)) * 0.5; - end - if j == 1 - Ey(i, j) = (Vmap(i, j + 1) - Vmap(i, j)); - elseif j == ny - Ey(i, j) = (Vmap(i, j) - Vmap(i, j - 1)); - else - Ey(i, j) = (Vmap(i, j + 1) - Vmap(i, j - 1)) * 0.5; - end - end -end +%for i = 1:nx + %for j = 1:ny + %if i == 1 + %Ex(i, j) = (Vmap(i + 1, j) - Vmap(i, j)); + %elseif i == nx + %Ex(i, j) = (Vmap(i, j) - Vmap(i - 1, j)); + %else + %Ex(i, j) = (Vmap(i + 1, j) - Vmap(i - 1, j)) * 0.5; + %end + %if j == 1 + %Ey(i, j) = (Vmap(i, j + 1) - Vmap(i, j)); + %elseif j == ny + %Ey(i, j) = (Vmap(i, j) - Vmap(i, j - 1)); + %else + %Ey(i, j) = (Vmap(i, j + 1) - Vmap(i, j - 1)) * 0.5; + %end + %end +%end + +[Ex,Ey] = gradient(Vmap); Ex = -Ex; Ey = -Ey;