%--------------------------------------------------------------------------
%   [vpp] = dbm2vpp(dbm,R)
%--------------------------------------------------------------------------
%   功能:
%   dbm 单位转化为电压值 
%--------------------------------------------------------------------------
%   输入:
%           dbm                 signal peak to peak volt
%           R                   阻抗匹配(默认为50Ω)
%   输出:
%           vpp
%--------------------------------------------------------------------------
%   例子:   
%   dBm2vpp(0)
%   ans = 0.6325
%   dbm2vpp(1,50)
%   ans = 0.7096
%--------------------------------------------------------------------------
function vpp = dbm2vpp(dbm,R)
if nargin==1
    R=50;
end
vpp = 2*10.^((dbm-30+10*log10(2.*R))./20);
end