MATLAB $\tt pwelch$ unit conversion Assuming the signal ($x$) is in volts.

The output units of pwelch are stated to be $V^2/\text{Hz}$. I wanted to confirm this so I ran:

fs = 48000;
t = [0:1/fs:5-1/fs];
x = 0.5*cos((2*pi*1000)*t);
[pxx f] = pwelch(x, 1024, 512, 1024, fs, 'onesided');
[m,i] = max(pxx);
sqrt(m*f(i))


Which results in $1.2697$ not $0.5$. There must be something I am missing! Anyone know what it is?
@Yatekii The linked you shared helped solve the problem. I needed to take into account (1) the gain of the window used and (2) summate over a short range of frequencies. Below is the updated code:

% Create signal
    fs = 48000;t = 0:1/fs:5-1/fs;
    A = 0.5; 
    x = A*cos((2*pi*1000)*t);
    % Run FFT
    [pxx, f] = pwelch(x, 1024, 512, 1024, fs, 'one-sided');

    % Spectral parameters
    df = f(2) - f(1);
    CG = 0.54;
    NG = 0.3974;

    % Extract peak value
    isig = round(1000/df)+1;
    Aout = sqrt(sum(pxx(isig-5:isig+5)*df)) * sqrt(2);