% Parameters
gamma = 1.5;
t_values = linspace(0, 1, 1000);
a = @(gamma) (1 - sqrt(gamma))^2;
b = @(gamma) (1 + sqrt(gamma))^2;

% MP continuous density function between a and b
mp_continuous_pdf = @(s, gamma) arrayfun(@(x) (1 / (2 * pi * gamma * x)) * sqrt((b(gamma) - x) * (x - a(gamma))) * (x >= a(gamma) & x <= b(gamma)), s);

% w(t), v(t), and u(t) functions
w_t = @(t, gamma) (1 - (gamma > 1) * (1 - 1 / gamma) * (1 - exp(-t * 0)) - gamma * integral(@(s) (1 - exp(-t * s)) .* mp_continuous_pdf(s, gamma), a(gamma), b(gamma)))^2;
v_t = @(t, gamma) (gamma > 1) * (1 - 1 / gamma) * exp(-2 * t * 0) + integral(@(s) exp(-2 * t * s) .* mp_continuous_pdf(s, gamma), a(gamma), b(gamma));
u_t = @(t, gamma) integral(@(s) s .* exp(-2 * t * s) .* mp_continuous_pdf(s, gamma), a(gamma), b(gamma));

% Compute values for w(t) * v(t) and u(t)
w_times_v_values = arrayfun(@(t) w_t(t, gamma) * v_t(t, gamma), t_values);
u_values = arrayfun(@(t) u_t(t, gamma), t_values);

% Plot w(t) * v(t) and u(t)
figure
semilogy(t_values, w_times_v_values, t_values, u_values, ...
    'LineWidth', 2);
% ytick_locations = [0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
% ytick_labels = {'0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1'};
font_size_legend = 14;
font_size_axis = 16;

xlabel('$T$', 'Interpreter', 'latex', 'FontSize', font_size_axis);
ylabel('Function value', 'Interpreter', 'latex', 'FontSize', font_size_axis);
legend('LHS (signal component)', 'RHS (signal component)');
title('Overparameterized ($\zeta_{\ast} = 1.5$)', 'Interpreter', 'latex', 'FontSize', font_size_axis);
grid on;
legend box off
legend('Location', 'northeast', 'FontSize', font_size_legend)

% title(['Plot of w(t) * v(t) and u(t) for \gamma = ', num2str(gamma)]);

grid on;

saveas(gcf, 'gf_limit_mismatch_in_t_overparam_bias', 'epsc')
saveas(gcf, 'gf_limit_mismatch_in_t_overparam_bias', 'png')