data analysis on s-凯发k8网页登录
this example shows how to perform statistical analysis on a set of s-parameter data files using magnitude, mean, and standard deviation (std).
first, read twelve s-parameter files, where these files represent the twelve similar rf filters into the matlab® workspace and plot them. next, plot and analyze the passband response of these filters to ensure they meet statistical norms.
read s-parameters from filter data files
use built-in rf toolbox™ functions for reading a set of s-parameter data files. for each filter plot the s21 db values. the names of the files are aws_filter_1.s2p through aws_filter_12.s2p. these files represent 12 passband filters with similar specifications.
numfiles = 12; filename = "aws_filter_" (1:numfiles) ".s2p"; % construct filenames s = sparameters(filename(1)); % read file #1 for initial set-up freq = s.frequencies; % frequency values are the same for all files numfreq = numel(freq); % number of frequency points s21_data = zeros(numfreq,numfiles); % preallocate for speed s21_groupdelay = zeros(numfreq,numfiles); % preallocate for speed % read touchstone files for n = 1:numfiles s = sparameters(filename(n)); s21 = rfparam(s,2,1); s21_data(:,n) = s21; s21_groupdelay(:,n) = groupdelay(s,freq,2,1); end s21_db = 20*log10(abs(s21_data)); figure plot(freq/1e9,s21_db) xlabel('frequency (ghz)') ylabel('filter response (db)') title('transmission performance of 12 filters') axis on grid on
filter passband visualization
in this section, find, store, and plot the s21 data from the aws downlink band (2.11 - 2.17 ghz).
idx = (freq >= 2.11e9) & (freq <= 2.17e9); s21_pass_data = s21_data(idx,:); s21_pass_db = s21_db(idx,:); freq_pass_ghz = freq(idx)/1e9; % normalize to ghz plot(freq_pass_ghz,s21_pass_db) xlabel('frequency (ghz)') ylabel('filter response (db)') title('passband variation of 12 filters') axis([min(freq_pass_ghz) max(freq_pass_ghz) -1 0]) grid on
basic statistical analysis of s21 data
to determine whether the data follows a normal distribution and if there is an outlier, perform statistical analysis on the magnitude and group delay of all passband s21 data sets.
abs_s21_pass_freq = abs(s21_pass_data);
calculate the mean and the std of the magnitude of the entire passband s21 data set.
mean_abs_s21 = mean(abs_s21_pass_freq,'all')
mean_abs_s21 = 0.9289
std_abs_s21 = std(abs_s21_pass_freq(:))
std_abs_s21 = 0.0104
calculate the mean and std of the passband magnitude response at each frequency point. this determines if the data follows a normal distribution.
mean_abs_s21_freq = mean(abs_s21_pass_freq,2); std_abs_s21_freq = std(abs_s21_pass_freq,0,2);
plot all the raw passband magnitude data as a function of frequency, as well as the upper and lower limits defined by the basic statistical analysis.
plot(freq_pass_ghz,mean_abs_s21_freq,'m') hold on plot(freq_pass_ghz,mean_abs_s21_freq 2*std_abs_s21_freq,'r') plot(freq_pass_ghz,mean_abs_s21_freq - 2*std_abs_s21_freq,'k') legend('mean','mean 2*std','mean - 2*std') plot(freq_pass_ghz,abs_s21_pass_freq,'c','handlevisibility','off') grid on axis([min(freq_pass_ghz) max(freq_pass_ghz) 0.9 1]) ylabel('magnitude s21') xlabel('frequency (ghz)') title('s21 (magnitude) - statistical analysis') hold off
plot a histogram for the passband magnitude data. this determines if the upper and lower limits of the data follow a normal distribution.
histfit(abs_s21_pass_freq(:)) grid on axis([0.8 1 0 100]) xlabel('magnitude s21') ylabel('distribution') title('compare filter passband response vs. a normal distribution')
get the groupdelay of the passband s21 data. use inner 60% of the bandwith for statistical analysis of the groupdelay and normalize it to 10 ns.
idx_gpd = (freq >= 2.13e9) & (freq <= 2.15e9); freq_pass_ghz_gpd = freq(idx_gpd)/1e9; % normalize to ghz s21_groupdelay_pass_data = s21_groupdelay(idx_gpd,:)/10e-9; % normalize to 10 ns
calculate the per-frequency mean and standard deviation of the normalized group delay response. all the data is collected into a single vector for alter analysis.
mean_grpdelay_s21 = mean(s21_groupdelay_pass_data,2); std_grpdelay_s21 = std(s21_groupdelay_pass_data,0,2); all_grpdelay_data = reshape(s21_groupdelay_pass_data.',numel(s21_groupdelay_pass_data),1);
plot all the normalized passband groupdelay data as a function of frequency, including the upper and lower limits defined by the basic statistical analysis.
plot(freq_pass_ghz_gpd,mean_grpdelay_s21,'m') hold on plot(freq_pass_ghz_gpd,mean_grpdelay_s21 2*std_grpdelay_s21,'r') plot(freq_pass_ghz_gpd,mean_grpdelay_s21 - 2*std_grpdelay_s21,'k') legend('mean','mean 2*std','mean - 2*std') plot(freq_pass_ghz_gpd,s21_groupdelay_pass_data,'c','handlevisibility','off') grid on xlim([min(freq_pass_ghz_gpd) max(freq_pass_ghz_gpd)]) ylabel('normalized group delay s21') xlabel('frequency (ghz)') title('s21 (normalized group delay) - statistical analysis') hold off
plot a histogram for the normalized passband group delay data. this determines if the upper and lower limits of the data follow a uniform distribution.
histogram(all_grpdelay_data,35) grid on xlabel('group delay s21 (seconds)') ylabel('distribution') title('histogram of the normalized group delay')