Skip to content

Commit

Permalink
Node generation files
Browse files Browse the repository at this point in the history
  • Loading branch information
nolte committed Feb 1, 2021
1 parent 57a1f9f commit 2b4f2b3
Show file tree
Hide file tree
Showing 16 changed files with 1,030 additions and 0 deletions.
44 changes: 44 additions & 0 deletions MakeIntraSet.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
% function Iset = MakeIntraSet(PatName)
% Converted from BuildIntraSet on 9/1/17
% Iset.FVIntra(Nperm,Nbm)

function Iset = MakeIntraSet(PatName)

homepath = pwd;
sz = length(homepath);
flag = 0; ind = 0;
while flag == 0
ind = ind + 1;
if strcmp(homepath(sz-ind),'/')
flag = 1; endpth = sz-ind;
end
end
TrialName = homepath(endpth+1:sz);

compressin = input('Compressed input: 0 = raw 1 = compressed');

Trialfile = strcat(TrialName,'_Trial');
run(Trialfile)

if compressin == 1
pathwrk = strcat(homepath,'/dbOutComp',TrialName);
else
pathwrk = strcat(homepath,'/dbOut',TrialName);
end

Nperm = Ndrug*(Ndrug-1)/2;
Npat = 1;

Ptmp = Pat2WellSet(PatName,drug,pathwrk); %FUNCTION: /Userfunctions/Pat2WellSet

Isetmp = IntraSet(Ptmp); % OBJECT: WellSet

Iset.FVIntra(:,:) = Isetmp.FVIntra(1,:,:);
Iset.FVIntrast(:,:) = Isetmp.FVIntrast(1,:,:);

Iset.PatientName = PatName;
Iset.DrugName = drug;
Iset.Npat = Npat;
Iset.Ndrug = Ndrug;
Iset.Nperm = Ndrug*(Ndrug-1)/2;

50 changes: 50 additions & 0 deletions coupleN0.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
% function omegout = coupleN0(omega,g,gext)
% function omegout = coupleN0(omega,g,gext)
% Similar to coupleN, but for global coupling with variable coupling coeffs
% includes a coupling matrix g(cloop,omloop)

function omegout = coupleN0(omega,g,gext)

[dum,N] = size(omega);
mnomega = 1.0;

options = odeset('AbsTol',1e-3);

y0 = omega;
tspan = [0 400];
[t,y] = ode45(@f5,tspan,y0);
[sy,dum] = size(y);

y1 = y(40,:);

tspan = [0 400];

[t,y] = ode45(@f5,tspan,y1);

for omloop = 1:N
[m(omloop),b(omloop)] = linfit(t,y(:,omloop));
w(omloop) = mnomega + m(omloop);
% disp(strcat('Freq',num2str(omloop),' = ',num2str(m(omloop))))
end

omegout = m;

function yd = f5(t,y)

for omloop = 1:N
temp = omega(omloop);
for cloop = 1:N
temp = temp + g(cloop,omloop)*sin(y(cloop)-y(omloop)) - gext*sin(y(omloop));
end
yp(omloop) = temp;
end

for omloop = 1:N
yd(omloop,1) = yp(omloop);
end

end % end f5


end % end vandpol

Loading

0 comments on commit 2b4f2b3

Please sign in to comment.