summaryrefslogtreecommitdiff
path: root/report/figures/tracy-widom-approx/plot_tracy_widom.m
blob: c43e3f6a2ddfc77d7bc75d43eccbc6c1988805b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
close all;
clear; clc;

x = linspace(-6,4,1000)

[pdf1,~] = tracywidom_appx(x,1)
[pdf2,~] = tracywidom_appx(x,2)
[pdf4,~] = tracywidom_appx(x,4)

% Fig. 1 Tracy-Widoms
figure(1)
hold on
plot(x,pdf1)
plot(x,pdf2)
plot(x,pdf4)

A = [x', pdf1', pdf2', pdf4']
save -ascii tracy_widom.txt A

% Fig 2. Compare to Normal
normpdf = @(x,mu,sigma) 1/(sigma*sqrt(2*pi)).*exp(-0.5*((x-mu)/sigma).^2)
npdf = normpdf(x,-1.38,1.268)

figure(2)
hold on
plot(x,pdf1)
plot(x,npdf,'--')

B = [x', pdf1', npdf']
save -ascii tracy_widom_normal.txt B

% Skewness and Excess Kurtosis
x_stat = linspace(-9,9,50e3)
[pdf1_stat,~] = tracywidom_appx(x_stat,1)
npdf_stat = normpdf(x_stat, -1.38, 1.268)

fprintf("Tracy Widom\n")
[~,~] = pdf_stats(x_stat, pdf1_stat)
fprintf("Normal Distribution\n")
[~,~] = pdf_stats(x_stat, npdf_stat)