s = tf('s'); % sets 's' as the Laplace variable

%% Model of your converter
%Note, example transfer function likely does not match your converter's
%transfer function
wp1 = 2*pi*1e3;
wp2 = 2*pi*10e3;
wz1 = 2*pi*100e3;
Gvd0 = 10;
Gvd = Gvd0*(1+s/wz1)/((1+s/wp1)*(1+s/wp2));

[MAG,PHASE,W] = bode(Gvd);  % store bode plot data of model


%% Converter measurements
% replace with your measured data from the experiment
f = [100 1e3 5e3 10e3 20e3];  % Frequency of the measurements
mag = [10 10 5 2 .5];  %Magnitude of Gvd.  In linear (non-dB) units
phase = [0 -45 -80 -110 -130];  %Phase of Gvd, in degrees)


%% Plotting
% this code will plot both the analytical and measured data on the same
% axes
subplot(2,1,1)
semilogx(W/2/pi, 20*log10(MAG(:)), '-b', 'LineWidth', 3)
hold on;
semilogx(f,20*log10(mag),'or', 'LineWidth', 3);
xlabel('Frequency [Hz]');
ylabel('Magnitdue [dB]');
legend('Analytical Model', 'Converter Measurements');
hold off;

subplot(2,1,2)
semilogx(W/2/pi, PHASE(:), '-b', 'LineWidth', 3);
hold on;
semilogx(f,phase,'or', 'LineWidth', 3);
xlabel('Frequency [Hz]');
ylabel('Phase [{\circ}]');
hold off;