-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for v2 of paper, datasets are smaller and add fluid flow examples
- Loading branch information
Showing
9 changed files
with
161 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
numICs = 200*200*21/20; | ||
numICs = 5000; | ||
filenamePrefix = 'DiscreteSpectrumExample'; | ||
|
||
x1range = [-.5, .5]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
numTest_ICs = 5000; | ||
filenamePrefix = 'FluidFlowBox'; | ||
|
||
x1range = [-1.1,1.1]; | ||
x2range = [-1.1,1.1]; | ||
x3range = [0,2.42]; | ||
tSpan = 0:0.01:1; | ||
max_x3 = 2.5; | ||
|
||
seed = 1; | ||
X_test = FluidFlowBoxFn(x1range, x2range, x3range, numTest_ICs, tSpan, seed, max_x3); | ||
filename_test = strcat(filenamePrefix, '_test_x.csv'); | ||
dlmwrite(filename_test, X_test, 'precision', '%.14f') | ||
|
||
seed = 2; | ||
X_val = FluidFlowBoxFn(x1range, x2range, x3range, numTest_ICs, tSpan, seed, max_x3); | ||
filename_val = strcat(filenamePrefix, '_val_x.csv'); | ||
dlmwrite(filename_val, X_val, 'precision', '%.14f') | ||
|
||
for j = 1:20 | ||
seed = 2+j; | ||
X_train = FluidFlowBoxFn(x1range, x2range, x3range, numTest_ICs, tSpan, seed, max_x3); | ||
filename_train = strcat(filenamePrefix, sprintf('_train%d_x.csv', j)); | ||
dlmwrite(filename_train, X_train, 'precision', '%.14f') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function X = FluidFlowBoxFn(x1range, x2range, x3range, numICs, tSpan, seed, max_x3) | ||
|
||
|
||
% try some initial conditions for x1, x2 | ||
rng(seed) | ||
|
||
b = 0; | ||
mu = 0.1; | ||
omega = 1; | ||
lambda = -10; | ||
A = -mu; | ||
dynsys = @(t,x) weaklyNL(x,b,mu,omega,lambda,A); | ||
|
||
lenT = length(tSpan); | ||
|
||
X = zeros(numICs*lenT, 3); | ||
count = 1; | ||
|
||
for j = 1:10*numICs | ||
% randomly start from x1range(1) to x1range(2) | ||
x1 = (x1range(2)-x1range(1))*rand+x1range(1); | ||
|
||
% randomly start from x2range(1) to x2range(2) | ||
x2 = (x2range(2)-x2range(1))*rand+x2range(1); | ||
|
||
% randomly start from x3range(1) to x3range(2) | ||
x3 = (x3range(2)-x3range(1))*rand+x3range(1); | ||
|
||
|
||
ic = [x1; x2; x3]; | ||
|
||
[T, temp] = ode45(dynsys, tSpan, ic); | ||
|
||
if max(temp(:,3)) > max_x3 | ||
sprintf('traj goes too big: %.15f', max(temp(:,3))) | ||
continue | ||
else | ||
X(1+(count-1)*lenT : lenT + (count-1)*lenT,:) = temp; | ||
|
||
if count == numICs | ||
break | ||
end | ||
count = count + 1; | ||
end | ||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
numTest_ICs = 5000; | ||
filenamePrefix = 'FluidFlowOnAttractor'; | ||
|
||
Rrange = [0,1.1]; | ||
Trange = [0,2*pi]; | ||
tSpan = 0:0.05:6; | ||
|
||
|
||
seed = 1; | ||
X_test = FluidFlowOnAttractorFn(Rrange, Trange, numTest_ICs, tSpan, seed); | ||
filename_test = strcat(filenamePrefix, '_test_x.csv'); | ||
dlmwrite(filename_test, X_test, 'precision', '%.14f') | ||
|
||
seed = 2; | ||
X_val = FluidFlowOnAttractorFn(Rrange, Trange, numTest_ICs, tSpan, seed); | ||
filename_val = strcat(filenamePrefix, '_val_x.csv'); | ||
dlmwrite(filename_val, X_val, 'precision', '%.14f') | ||
|
||
for j = 1:20 | ||
seed = 2+j; | ||
X_train = FluidFlowOnAttractorFn(Rrange, Trange, numTest_ICs, tSpan, seed); | ||
filename_train = strcat(filenamePrefix, sprintf('_train%d_x.csv', j)); | ||
dlmwrite(filename_train, X_train, 'precision', '%.14f') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function X = FluidFlowOnAttractorFn(Rrange, Trange, numICs, tSpan, seed) | ||
|
||
|
||
% try some initial conditions for R, T | ||
rng(seed) | ||
|
||
b = 0; | ||
mu = 0.1; | ||
omega = 1; | ||
lambda = -10; | ||
A = -mu; | ||
dynsys = @(t,x) weaklyNL(x,b,mu,omega,lambda,A); | ||
|
||
lenT = length(tSpan); | ||
|
||
X = zeros(numICs*lenT, 3); | ||
|
||
count = 1; | ||
for j = 1:2*numICs | ||
% randomly start from Rrange(1) to Rrange(2) | ||
R = (Rrange(2)-Rrange(1))*rand+Rrange(1); | ||
|
||
% randomly start from Trange(1) to Trange(2) | ||
T = (Trange(2)-Trange(1))*rand+Trange(1); | ||
|
||
x1 = R*cos(T); | ||
x2 = R*sin(T); | ||
x3 = x1^2 + x2^2; | ||
|
||
ic = [x1; x2; x3]; | ||
|
||
[T, temp] = ode45(dynsys, tSpan, ic); | ||
|
||
X(1+(count-1)*lenT : lenT + (count-1)*lenT,:) = temp; | ||
if count == numICs | ||
break | ||
end | ||
count = count + 1; | ||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function dy = weaklyNL(y,b,mu,omega,lambda,A) | ||
|
||
dy = [ | ||
mu*y(1) - omega*y(2) + A*y(1)*y(3); | ||
omega*y(1) + mu*y(2) + A*y(2)*y(3) + b; | ||
lambda*(y(3)-y(1).^2-y(2).^2); | ||
]; |