Parsing .s2p data Matlab code example

Example: Parsing .s2p data Matlab

DataFileName = 'cpl iso.s2p';
[freq, raw_data,data, freq_noise, data_noise, Zo] = SXPParse(DataFileName);

% interested s-parameters data
interested_data = raw_data(301:401,:); %dB and angle (degrees)
interested_freq = freq(301:401); %Hz

%Magnitude
subplot(2,1,1)
plot(interested_freq,interested_data(:,3),'-r');
hold on
plot(interested_freq,interested_data(:,5),'-b');
legend('S21','S12');
xlabel('Frequency (Hz)','fontsize',12,'fontweight','b')
ylabel ('Amplitude (dB)','fontsize',12,'fontweight','b')
title ('1 - CPL, 2 - ISO','fontsize',16,'fontweight','b')

Tags:

Misc Example