# How to plot input reflection coefficient in dB scale using Matlab

So I have a problem that asks to plot the input reflection coefficient of a transformer in dB scale between 0.5 GHz and 4 GHz using Matlab. Here is the code I have thus far, it is plotting in Reflection Coefficient (y-axis) vs Frequency (x-axis). I'm not sure how to convert it to the dB scale.

f0 = 1e9;             %% Defining operational frequency
c  = 3e8;             %% Defining speed of light constant
f = [0:0.01:4]*1e9;   %% Defining frequency scale
lambda = c./f;        %% Defining wavelength equation
lambda_0 = c/f0;      %% Defining wavelength equation
ZL = 120;             %% Defining input impedance
Z0 = 60;              %% Defining characteristic impedance
Z0p = sqrt(ZL*Z0);    %% Defining transformer impedance equation
beta = 2*pi./lambda;  %% Defining phase constant equation
ell = lambda_0/4;     %% Defining quarter wavelength euqation

t = tan(beta.*ell);   %% Defining time equation

Zin = Z0p * (ZL+j*Z0p.*t)./(Z0p+j*ZL.*t); %% Defining input impedance equation
gamma = (Zin-Z0)./(Zin+Z0);               %% Defining reflection loss equation
agamma = abs(gamma);                      %% Defining abs value of rl

plot(f/1e9,agamma,'b','linewidth',2);     %% Defining plot
xlabel('frequency (GHz)');                %% Defining x-axis label
ylabel('|\Gamma|');                       %% Defining y-axis label
grid on;                                  %% Grid on

• are you simply asking how to get dB from linear ratio? dB = 20*log10(linear ratio)! – Neil_UK Oct 26 '18 at 4:36
• 20*log10() for a ratio of fields/voltages/currents. 10*log10() for a ratio of powers. – The Photon Oct 26 '18 at 5:51