Files
FAR_CS/Block RIP/Phase transitions/block_phase_transition.m
T
2024-05-09 16:48:34 +08:00

40 lines
921 B
Matlab

function pt = block_phase_transition(N, M)
tau_min = 0;
tau_max = 10;
tau_interval = 0.05;
tau_range = tau_min:tau_interval:tau_max;
K_min = 1;
K_max = 25;
K_range = K_min:K_max;
pt = zeros(25, 1);
cache_filename = "I.mat";
if exist(cache_filename, "file")
load(cache_filename);
else
I = zeros(length(tau_range), 0);
for tau_idx = 1:length(tau_range)
tau = tau_range(tau_idx);
I(tau_idx) = calc_block_integral(tau, 4);
end
save I.mat
end
for K_idx = 1:length(K_range)
K = K_range(K_idx);
f_set = zeros(length(tau_range), 1);
for tau_idx = 1:length(tau_range)
tau = tau_range(tau_idx);
f_set(tau_idx) = 1/2 * (K * (2 * M + tau ^ 2) + (N - K) * I(tau_idx));
end
pt(K_idx) = min(f_set);
end
end