-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit before creating new rep on Gitlab
- Loading branch information
Showing
24 changed files
with
311 additions
and
145 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
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
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 was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
Matlab/karma_nash_equilibrium/ne_functions/write_sigma_csv.m
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,36 @@ | ||
% Wrtie stationary karma distribution to csv file | ||
function n_k = write_sigma_csv(sigma_down_mu_alpha_up_k, sigma_up_k, param, ne_param, sigma_tol, fileprefix) | ||
n_k = ne_param.n_k; | ||
K = ne_param.K; | ||
|
||
% Remove tail of distribution where there are too few agents | ||
while sigma_up_k(n_k) < sigma_tol | ||
n_k = n_k - 1; | ||
end | ||
if n_k == length(K) | ||
K(end+1) = K(end) + 1; | ||
sigma_down_mu_alpha_up_k(:,:,end+1) = 0; | ||
end | ||
|
||
% Renormalize | ||
sigma_down_mu_alpha_up_k = sigma_down_mu_alpha_up_k ./ sum(sigma_down_mu_alpha_up_k, 3); | ||
|
||
% Header | ||
header = ["mu", "alpha", "k", "k2", "P(k)"]; | ||
filename = [fileprefix, '.csv']; | ||
fout = fopen(filename, 'w'); | ||
for i = 1 : length(header) - 1 | ||
fprintf(fout, '%s,', header(i)); | ||
end | ||
fprintf(fout, '%s\n', header(end)); | ||
fclose(fout); | ||
|
||
% Data | ||
for i_mu = 1 : param.n_mu | ||
MU = i_mu * ones(n_k + 1, 1); | ||
for i_alpha = 1 : param.n_alpha | ||
data = [MU, param.Alpha(i_alpha) * ones(n_k + 1, 1), K(1:n_k+1), K(1:n_k+1) - 0.5, squeeze(sigma_down_mu_alpha_up_k(i_mu,i_alpha,1:n_k+1))]; | ||
dlmwrite(filename, data, '-append'); | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
...10_phi1_0.50_0.50_0.50_0.50_alpha1_0.30_alpha2_0.97_pay_0/ne_efficiency/all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
....50_0.50_0.50_0.50_alpha1_0.30_alpha2_0.97_pay_0/ne_efficiency/k_bar_slices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...1_0.50_0.50_0.50_0.50_alpha1_0.30_alpha2_0.97_pay_0/ne_efficiency/z1_slices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.00_1.00.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.10_0.90.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.20_0.80.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.30_0.70.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.40_0.60.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.50_0.50.mat
Binary file not shown.
Binary file added
BIN
+1.1 MB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.60_0.40.mat
Binary file not shown.
Binary file added
BIN
+844 KB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.70_0.30.mat
Binary file not shown.
Binary file added
BIN
+843 KB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.80_0.20.mat
Binary file not shown.
Binary file added
BIN
+846 KB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_0.90_0.10.mat
Binary file not shown.
Binary file added
BIN
+842 KB
...1_0.50_0.50_0.50_0.50_phi2_0.33_0.67_0.33_0.67_alpha1_0.97_pay_0/k_bar_10_w_1.00_0.00.mat
Binary file not shown.
Oops, something went wrong.